SCENARIO NAME :Check all broken links 'DESCRIPTION :This code Check all links in any web page 'PRECONDITIONS :This Assume that when click on Link the new page will open on current window but not in new window 'AUTHOR : Akhalesh '***************************** ****************************************** systemutil.run "iexplore","http://www.google.com" Set oDesc = Description.Create() ' Retrieve HTML tag oDesc("html tag").Value = "A" Set rc = Browser("title:=.*").Page("title:=.*").ChildObjects(oDesc) num = rc.Count() 'get the number of link in a page For i=0 to num-1 Set rc = Browser("title:=.*").Page("title:=.*").ChildObjects(oDesc) ref = rc(i).GetROProperty("href") 'get the “href”propety of the i th link names=rc(i).getroproperty("name") Browser("title:=.*").Page("title:=.*").link("text:=.*","index:="&i).click 'click on i th link Browser("title:=.*").sync title1=Browser("title:=.*").getRoproperty("title") 'get the tile of the target page MsgBox title1 Browser("title:=.*").navigate(ref) 'Navigates to the url taken from “href” property Browser("title:=.*").sync title2=Browser("title:=.*").getRoproperty("title") 'get the tile of the tNavigated page MsgBox title2 If title1=title2 Then 'condition to check for the targetted page and Navigated page Reporter.ReportEvent 0, "Navigated To Correct Page",""&title1 'Reports if correct Print "Link navigated to correct page..." &names else 'Reporter.ReportEvent 1,"hhh",&title1,"",&title2 print "Link did't navigated to correct page......." & names msgbox "hi" End If Browser("title:=.*").navigate "www.google.com" 'Navigates back to main page Browser("title:=.*").Sync next
Thanks... Akhalesh Yadav *We Value What We Do......* On Thu, May 16, 2013 at 3:18 PM, Ganesh muralidharan <[email protected]>wrote: > > http://www.automationrepository.com/2012/03/how-to-identify-broken-links-using-qtp/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+automationrepository%2Ffeeds+%28Automation+Repository%29 > > Thanks to Anish > > > On Thu, May 16, 2013 at 4:41 AM, Amit Kumar <[email protected]>wrote: > >> Please share your idea guys. need help on this... >> >> >> Thanks, >> Amit >> >> -- >> -- >> You received this message because you are subscribed to the Google >> "QTP - HP Quick Test Professional - Automated Software Testing" >> group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/MercuryQTP?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "QTP - HP Quick Test Professional - Automated Software Testing" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Regards, > > > Ganesh Muralidharan > 'God Never Forgets' > > -- > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "QTP - HP Quick Test Professional - Automated Software Testing" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Akhalesh yadav +919555717928 +919310680659 -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
