11-23-2010, 02:44 PM
|
How to click all the links on page and verify respective contents
|
|
11-23-2010, 05:34 PM
(This post was last modified: 11-23-2010, 05:50 PM by KavitaPriyaCR.)
Hi
please find the below example Code: Set oDesc = Description.Create()
oDesc("html tag").Value = "A"
Set rc = Browser().Page().ChildObjects(oDesc)
num = rc.Count()
For i=0 to num-1
tag = rc(i).GetROProperty("innertext")
href = rc(i).GetROProperty("href")
Reporter.ReportEvent 0, "Links in Page", "name: " & tag & "; url: " & href
NextIf you want to click on the link...then inside the for loop you can write rc(i).Click
11-23-2010, 06:01 PM
Thanks kavitaPriya,
I used same script, but after clicking First link, it stopped and not proceed further without any error. Also it's not clear in which order it will going to click , so how can i insert checkpoint with respect to that page ?
11-23-2010, 06:15 PM
Yes i thought of telling you this.
Browser properties may change when you click on the links each time... please check this and let me know.
11-23-2010, 10:26 PM
Hi KavitaPriya,
I tried it with following script. Code: Set oLinks = Description.Create
oLinks("micclass").value = "Link"
set objLinks = Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").ChildObjects(oLinks)
LinkCount = objLinks.Count
msgbox LinkCount
For i = 0 to LinkCount-1step 1
linkname=objLinks(i).getroproperty("name")
msgbox linkname,0,"Current link is"
objLinks(cint(i)).Click
nextBut I am getting following error. The test run cannot continue due to an unrecoverable error. General run error. Line (9): "objLinks(cint(i)).Click". The test run cannot continue due to an unrecoverable error.
11-24-2010, 12:37 PM
Hi
What i meant was, the browser property may be changing after click action, its not necessary to usecInt function here it seems. For example in ur script Code: set objLinks = Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").ChildObjects(oLinks)
11-28-2010, 01:01 PM
Hi Kavitapriya,
yes the pagename is different for diff link. Also some links have same name.I tried with Object spy but didnt find any property which will display ' page name' value of the link. Will you pls suggest any workaround how to get page name of all available Links and click them ? Thanks in advance.
11-30-2010, 12:27 PM
Hi,
Try using class property for browser and page instead of the dynamic properties.
05-19-2011, 10:58 AM
I think once you get the links for a page the get the url of every link using GetRoProperty and store it in an array. Now once you have the url the you navigate to that url. now for every url you can put your checks for the respective page.
|
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| click each web link in a page using Index or other method in QTP | smeijer | 13 | 26,704 |
04-29-2017, 04:53 PM Last Post: kowshik |
|
| [UFT] [WPF] Verify if the cell contains an image | robertosalemi | 0 | 2,362 |
10-25-2016, 06:57 PM Last Post: robertosalemi |
|
|
|
Webtable contains cell contains two links, how to click on link | srinivassure | 9 | 55,452 |
07-30-2016, 03:41 PM Last Post: Akshay |
| Need to verify the drop down values based on condition | santhoshmscsoftware | 1 | 3,455 |
05-04-2016, 11:28 PM Last Post: supputuri |
|
| verify that parent properties match object currently displayed in your application. | sona | 0 | 3,496 |
02-21-2016, 12:00 PM Last Post: sona |
|
Users browsing this thread: 1 Guest(s)

