Suppose there are 100 links in a web page and the number of
links will be changing dynamically from time to time. I
need code such that every time i had to click on the last
link of the web page.

Answers were Sorted based on User's Feedback



Suppose there are 100 links in a web page and the number of links will be changing dynamically fro..

Answer / amarendra kothuru

Below code will work for your case.

' Set a description object to identify links.
Set oDesc = Description.Create()
oDesc("html tag").Value = "A"

' Get a collection of links
Set oLinkCollection = Browser("test").Page
("test").ChildObjects(oDesc)
Set obj=oLinkCollection.Item(oLinkCollection.Count-1)
obj.Click

Is This Answer Correct ?    6 Yes 1 No

Suppose there are 100 links in a web page and the number of links will be changing dynamically fro..

Answer / kiran

set odesc = decription.create

odesc("micclass").value = "Link"

set n = browser("xxx").page("xxx").childobjects(odesc)

objcount = n.count

browser("xxxx").page("xxxx").link("index:="&objcount-1).click

Is This Answer Correct ?    5 Yes 1 No

Suppose there are 100 links in a web page and the number of links will be changing dynamically fro..

Answer / qtp

set odesc = decription.create

odesc("micclass").value = "Link"

set n = browser("xxx").page("xxx").childobjects(odesc)

objcount = n.count
n(objcount-1).click

Is This Answer Correct ?    0 Yes 0 No

Suppose there are 100 links in a web page and the number of links will be changing dynamically fro..

Answer / kishore

set odesc = decription.create

odesc("micclass").value = "Link"

set n = browser("xxx").page("xxx").childobjects(odesc)

objcount = n.count

browser("xxxx").page("xxxx").link("index:="&objcount).click

Is This Answer Correct ?    5 Yes 6 No

Post New Answer

More QTP Interview Questions

interviwer asks what is data table? my ans is Data table is an internal Excel file of QTP...intervier not happy with this also? can u post any other answer?

3 Answers   Accenture,


What is Performance testing?

2 Answers   Crea,


1. I have asked the same question for the third time, but i am getting wrong answers. Pls give me the script to count the number of edit boxes or checkboxes in an windows application screen. In windows application childobject is not working, anyone very urgent

8 Answers  


Which line will be executed 1-B(DP).P(OR.link(DP) 2-B(OR).P(Or).Link(DP)

2 Answers   Broadridge,


Explain the difference between check point and output value?

0 Answers  






How we can add actions in the test using QTP?

4 Answers   BirlaSoft,


How can we close all webbrowsers which are opened in out desctop?

8 Answers  


is qtp 9.2 supported for firefox browser3.0?bcoz when i tried to create scripts with the application run on firefox browser 3.0 then qtp 9.2 didn't ct=reate the scripts?

2 Answers  


How many types of Test Plans are there...??

5 Answers  


What is the differences between image check point and bit map check point?

0 Answers  


In Datatable having the data like this S.no Name Address 1 raj hyderabad 2 suresh Mumbai 3 shyam chennai 4 dev banglore i want to get the shyam row id & column id using scipting i.e 3,3

4 Answers   Broadridge,


How to run scripts 1,29,3,5,7,2 scripts using test batch runner in QTP.... Ie...I wanted to run scripts not in an order 1,2,3,4,5...like that How it is possible using test batch runner... I dont want hardcoded script

0 Answers   IBM,


Categories