How can you check all the URLS / Links are connected and working correctly throughout the application with the help of scripting in Quick Test Professional Automation tools

Questions by vishalsdg-325

Showing Answers 1 - 19 of 19 Answers

Vivek

  • Apr 5th, 2006
 

you can use automated tools and websites available to test broken links.Just give the URL of the website and it will generate a report.

  Was this answer useful?  Yes

Vishal Asthana

  • Apr 5th, 2006
 

You can only thoes links which have been connected through that page, suppose one link is like, when you clik on that link a new uirl has been openedso how can you check

  Was this answer useful?  Yes

hi , This is srinivasulu. my answer is only system testing time you can check all the URL is perfectly working or not.

if one project u can connected one url , but sub-sequence url so many .

suppose u can take 10 sub url's in one project. Each sub Url is one application, once finished testing for all the applications. u test system testing , that time we combined all the applications and we did and we find its working or not.

if u want any clarification let me know.

Thanks

Srinivasulu.chittoor

  Was this answer useful?  Yes

amar_win

  • Apr 25th, 2006
 

Simple task like this should be automated. write perl script and check if a link is valid or not.

Pros:

1. You can even check dynamically created links

2. You can create an exe out of this script and run on any platform without perl installed on it ( please remember this is not portable meaning a windows created exe can be used on 95, 98, 2k, xp....only not on unix. but unix machnied always has perl these days )

  Was this answer useful?  Yes

Sriharsha

  • Jun 3rd, 2006
 

hi....

Im Afraid what u people might not be correct ( Plz note : m not offending anyone)

Checking URL's is called as Link Testing.

Now we use Xenu or Link alarm to check for Broken Links

We use Infocus or A-prompt too for these resons.

thers is a bit of diff between link alarm and infous.

 

  Was this answer useful?  Yes

Vishal

  • Jun 5th, 2006
 

but u cant check the java script page and applet pages.

  Was this answer useful?  Yes

Nikki

  • Sep 12th, 2006
 

Cant we check links in Quick Test Pro,using Page checkpoint??

  Was this answer useful?  Yes

ven

  • Oct 31st, 2007
 

We can check the number of images, links, load time using page checkpoint.
once a page checkpoint is created, after runing script, in test analysis pane gives detailed count of links, images,..

  Was this answer useful?  Yes

ankurvohra

  • Jan 28th, 2008
 

Hi,

I heard that various open tool web spiders exist in the market which can crawl the application and check for the broken links in the web application.

Currently I can not access any open source tool so I was thinking is there any way we can do the same job of web spiders or crawlers using QTP.

I have found out that using Page checkpoint in QTP we can know the number of links and there load time with expected urls in the QTP, this web page checkpoint also checks for the broken links in the web application..
But somehow when I tried this on the web page its not working fine .

Randomly its showing number of web links as checked and number of then as Not checked under broken link.

here I am not sure of following :-

A) Not checked URL by QTP is really a broken link or not?
B) Is it possible to navigate full web application for broken link and url using qtp or its page specific only.

While I am trying to find out the answers to my query by further analyzing the test results I have got …

it would be great if someone can help me with the correct way of doing it , If someone has tried this before of QTP

Many Thanks,
Ankur

  Was this answer useful?  Yes

Function CheckLinks2 (BrowserObject, BrowserPage)
    CheckLinks2 = True

    sPage = "micclass:=Page"
    sBrowser = "creationtime:="
    Dim orgURL, orgCreationTime
    Dim i_Link, l_hWnd
    Dim b_newBrowser
    Dim s_LinkOuterText, s_LinkInnerText, s_Linkhref

    s_URL = BrowserPage.GetROProperty("url")
    l_hWnd = BrowserObject.GetROProperty("hwnd")

    i_CreationTime = 1

    i_LinkCount = BrowserPage.Object.links.Length - 1

    For i_Link = 0 To i_LinkCount

        If Trim(BrowserPage.Object.links(i_Link).target) = "" _
                And InStr(BrowserPage.Object.links(i_Link).href, "javascript:") = 0 Then
            b_newBrowser = False
        Else
            b_newBrowser = TRUE
        End If

        s_LinkOuterText = BrowserPage.Object.links(i_Link).outerText
        s_LinkInnerText = BrowserPage.Object.links(i_Link).innerText
        s_Linkhref = BrowserPage.Object.links(i_Link).href

        BrowserPage.Object.links(i_Link).click

        'Doing Browser.Exist with CreationTime:=1 when the browser does not
        'exist will give TRUE so i though of work around to compare the windows
        'handle for the old browser and the new browser with CreationTime:=1.
        'If they are same that mean no other window was opened.
        If b_newBrowser Then
            sBrowser = "CreationTime:=" & i_CreationTime
            l_newhWnd = CLng(Browser(sBrowser).GetROProperty("hwnd"))
            If CLng(l_hWnd) = l_newhWnd Then
                b_newBrowser = False
            End If
        End If

        On Error Resume Next
        If b_NewBrowser Then
            sBrowser = "CreationTime:=" & i_CreationTime
            Browser(sBrowser).sync
            Browser(sBrowser).Page(sPage).sync
        Else
            BrowserObject.sync
            BrowserPage.sync
        End If
        On Error GoTo 0

        Dim s_LinkDetails

        If b_NewBrowser Then
            sBrowser = "CreationTime:=" & i_CreationTime
            IHTML = Browser(sBrowser).Page(sPage).Object.Body.innerHTML
        Else
            IHTML = BrowserPage.Object.Body.innerHTML
        End If

        'Check if page was not able to be displayed you can update this code any time
        If (InStr(IHTML, "HTTP 404") <> 0) Or (InStr(IHTML, "cannot be displayed") <> 0) Then
            s_LinkDetails = "Link Broken" + vbCrLf + "Link Details:" + vbCrLf
            s_LinkDetails = s_LinkDetails + "OuterText: " + s_LinkOuterText + vbCrLf
            s_LinkDetails = s_LinkDetails + "InnerText: " + s_LinkInnerText + vbCrLf
            s_LinkDetails = s_LinkDetails + "href: " + s_Linkhref + vbCrLf
            s_LinkDetails = s_LinkDetails + "Links Open in New Browse: " & bNewBrowser & vbCrLf
            Reporter.ReportEvent micWarning, "Check Link(" & i_Link & ") -> " & s_LinkOuterText , s_LinkDetails
            CheckLinks2 = FALSE
        Else
            s_LinkDetails = "Link Working" + vbCrLf + "Link Details:" + vbCrLf
            s_LinkDetails = s_LinkDetails + "OuterText: " + s_LinkOuterText + vbCrLf
            s_LinkDetails = s_LinkDetails + "InnerText: " + s_LinkInnerText + vbCrLf
            s_LinkDetails = s_LinkDetails + "href: " + s_Linkhref + vbCrLf
            s_LinkDetails = s_LinkDetails + "Links Open in New Browse: " & bNewBrowser & vbCrLf
            Reporter.ReportEvent micPass, "Check Link(" & i_Link & ") -> " & s_LinkOuterText , s_LinkDetails
        End If

        If b_NewBrowser Then
            sBrowser = "CreationTime:=" & i_CreationTime
            While CLng(Browser(sBrowser).GetROProperty("hwnd"))<>l_hwnd
                On Error Resume Next
                Browser(sBrowser).Sync
                Browser(sBrowser).Page(sPage).Close
                On Error GoTo 0
                Browser(sBrowser).Close
                'Tackle links that open a new browser and also opens a popup using that
                'i_CreationTime=i_CreationTime + 1
            Wend

            i_CreationTime = 1

        Else
            On Error Resume Next
            BrowserObject.Navigate s_URL
            BrowserObject.Sync
            BrowserObject.Page.Sync
            On Error GoTo 0
        End If
    Next
End Function

'*********************  In QTP **************
Set BrowserObject = Browser("micClass:=Browser", "CreationTime:=0")
Set BrowserPage = BrowserObject.Page("micClass:=Page")
CheckLinks2 BrowserObject, BrowserPage
'********************************************

Yes .. we can check all the URS/Links provided in the webpage are working or not.

1)Get the child objects (Links/URLs) from that web page.
2)Select the link/URL
3)Search for any object in the page which is opened after selecting that link/URL

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions