Micro Focus QTP (UFT) Forums
how to click all the links - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: how to click all the links (/Thread-how-to-click-all-the-links)



how to click all the links - gaveyom - 08-10-2011

Hi All,


Below is the updated code

******************************************************

Code:
Set oLink = Description.Create()
oLink("micclass").Value = "Link"

Set all_Links = Browser("micclass:=Browser").Page("micclass:=Page").ChildObjects(oLink)

For i = 1 To all_Links.Count-1
    all_Links(i).click()
    wait 1
Next

******************************************************

Here the problem while clicking the 2nd link

it is working upto to click the FIRST link, but when it clicks the SECOND link it is showing error like General Error

kindly find the attachment for the screen shot

kindly let me know the issue why it is not able to click from second link

Thanks in advance


Thanks & Regards,
Sivakumar S


RE: how to click all the links - sshukla12 - 08-10-2011

Start the loop from i=0

Code:
For i = 0 To all_Links.Count-1
all_Links(i).click()
wait 1
Next

Correct me if wrong

Regards,
Sankalp


RE: how to click all the links - gaveyom - 08-10-2011

Hi,

That is not an issue we can start i value as i=0 or i=1, its depend on the requirement

if we start from i=0, then it will start clicking the link from 1st link
if we start from i=1, then it will start clicking the link from 2nd link

Regards,
Gaveyom


RE: how to click all the links - sshukla12 - 08-10-2011

How many links are there??
Just check, it might be the case when its going beyond the specified range.
if there are two links only and u r starting from i=1 than it will click on 2nd link only. it will skip the first link and will show the error when loop for the next.

Correct me if wrong.

Regards,
Sankalp


RE: how to click all the links - gaveyom - 08-10-2011

34 links are there, so there is no chance to get the error what have u said