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
#6
Solved: 11 Years, 6 Months, 3 Weeks ago
(07-22-2013, 09:28 AM)ravi.gajul Wrote: 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


Attached Files Image(s)
   
Reply


Messages In This Thread
RE: I want to count total no of links in a page and click one by one - by excellentpawan - 07-22-2013, 09:20 PM

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 25,050 04-29-2017, 04:53 PM
Last Post: kowshik
Question Webtable contains cell contains two links, how to click on link srinivassure 9 54,001 07-30-2016, 03:41 PM
Last Post: Akshay
  VB Script to count number of links in a web page. Suma Parimal 4 25,593 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 5,878 01-17-2015, 07:49 PM
Last Post: yogi4tech
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 5,591 07-10-2013, 04:13 PM
Last Post: RameshKrishnan

Forum Jump:


Users browsing this thread: 1 Guest(s)