Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to count total no of links in a page and click one by one
#2
Solved: 12 Years, 10 Months, 4 Weeks ago
This is expected because when we create a reference to the object and use it for the first time, QTP cashes the object and maps it to the run time object.It does this cashing to improve performance on the same object when used later.But when the application state has changed(page refreshed or changed) these object references are no longer valid.So I would suggest you to get the reference again before you click.
This is how you would do it.
Code:
Set objlink = description.Create()
objlink("micclass").value ="Link"
set links = browser("title:=.*").Page("title:=.*").ChildObjects(objlink)
totalnooflinks = links.count
For i =0 to links.count -1
    set links = browser("title:=.*").Page("title:=.*").ChildObjects(objlink)
    links(i).click
    browser("title:=.*").Back
Next
Reply


Messages In This Thread
RE: I want to count total no of links in a page - by ravi.gajul - 07-22-2013, 09:28 AM

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,298 04-29-2017, 04:53 PM
Last Post: kowshik
Question Webtable contains cell contains two links, how to click on link srinivassure 9 55,155 07-30-2016, 03:41 PM
Last Post: Akshay
  VB Script to count number of links in a web page. Suma Parimal 4 26,223 07-01-2015, 12:59 PM
Last Post: govind
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 6,727 01-17-2015, 07:49 PM
Last Post: yogi4tech
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 6,061 07-10-2013, 04:13 PM
Last Post: RameshKrishnan

Forum Jump:


Users browsing this thread: 1 Guest(s)