Micro Focus QTP (UFT) Forums
How to find the number of clicks on particulat link - 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: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to find the number of clicks on particulat link (/Thread-How-to-find-the-number-of-clicks-on-particulat-link)



How to find the number of clicks on particulat link - venkatbatchu - 07-30-2009

Hi All,
Scenario:
I have a one link called "Data Name" under this i could see some 200 data field values . By default all these field values shown in ascending order and when u click on this link manually page refreshes and still it will show the data fields in ascending order(Note: Here number of clicks on this link is "one" as of now) and by click on this link once again then the data field values will be shown in descneding order(Note: Here number of clicks on this link is "two" as of now)

Query: Here i need to find the number of clicks on a link "Data Name"
by this way i can put this logic in my code (Ex: if number of clicks are even then it will display in descending order, if number of clicks on this link are odd number then i could consider that displaying of fields are in ascending order

Please help in this regard to find the number of clicks on a particular link


RE: How to find the number of clicks on particulat link - Saket - 07-30-2009

take a variable to store the click counter say iClkCnt set value default as 0, and on every link.click increase this with one( iClkCnt = iClkCnt +1)
in this way you will get the count of link clicked and put your logic


RE: How to find the number of clicks on particulat link - venkatbatchu - 07-30-2009

Could u please explaing with clear example using any script


RE: How to find the number of clicks on particulat link - Saket - 07-30-2009

Hope this will help you
Code:
Dim nClkCnt
nClkCnt = 0

Browser("Browser").Page("Page").Link("Link1").Click

nClkCnt = nClkCnt + 1

nRem = nClkCnt mod 2
If  nRem = 0 Then
    msgbox "Click count is Even- displayed in descending order"
else
    msgbox "Click count is Odd -displayed in ascending order"
End If



RE: How to find the number of clicks on particulat link - venkatbatchu - 07-30-2009

Thanks alot, i have got the idea with this solution and i will implemet it in my code...