Question
2
Replies
22
Views
Cognizant Technology Solutions India PVT Ltd
Posted: October 12, 2018
Last activity: October 12, 2018
How to check new hyperlink created or not on webpage
Dear,
In one web page few list of hyperlinks are there. I want to monitor new hyper link is created or not.
If it is created i want to click on it. Kindly suggest me how we can do this.
Hi,
Let's try this:
1. Interrogate one of the links and make match rules universal enough so that it matches all existing links (and all future ones, assuming naming will be the same).
I used Element Inner Text with the Regex: January 1, 20[0-9][0-9] - December 31, 20[0-9][0-9]
Set UseKeys=True in lnkReport properties so that multiple instances of the lnkReport can be used simultaneously.
2. Create string variable that holds latest report name (strLatestReport on the screenshot below) and set its value - currently "January 1, 2017 - December 31, 2017".
3. Now you can iterate through lnkReport instances, compare value of each instance with the stored latest one and if newer is larger then click it (and update latest report name variable):
I don't know how often you need to check for a new link and on which conditions. You may need to store latest report value in a file and load it at startup, so that it is available and has correct value even after Runtime restart.
Hope this helps!