Forum Discussion

Queenzlander's avatar
Queenzlander
New Contributor
4 years ago
Solved

How to confirm the hyperlink URL without clicking the hyperlink?

Hi,
Does anyone know how to confirm the URL 'behind' a hyperlink is correct without having to click the hyperlink?

 

For example, I have a hyperlink on the screen with the label 'Home' and the 'a href' value of the hyperlink is "https://abc.com", for example. i.e./ <a href="https://abc.com/">Home</a>

 

When the mouse pointer hovers over the hyperlink, the URL is displayed above the status bar as "https://abc.com", as expected.

 

When executing the test manually, I can see that the URL is correct, but when I use the 'Record & Replay' functionality to capture my steps (hover functionality), there does not appear to be a way to confirm that the expected URL is found/displayed.

 

If a developer accidentally modifies the URL, my 'Record & Replay' test case would still pass, even though the wrong URL was linked to the 'Home' hyperlink based on the AI decided XPath. i.e./ //html[1]/body[1]/footer[1]/div[1]/div[1]/div[1]/ul[1]/li[1]/a[1]

 

Thank you in advance for any assistance.

  • Answer provided by Nick from CrossBrowserTesting:

     

    You can verify an HREF by using 'Add Expect' and selecting 'Element'. Once you have clicked on the element that contains the HREF, you will see a dialogue open. Change the Expect to 'Attribute' and the Name to 'HREF'.

     

    Usually, the Value will populate with a portion of the URL from the HREF, so I would recommend to paste in the entire link or adjust the 'To' field to Contains. 

1 Reply

Replies have been turned off for this discussion
  • Answer provided by Nick from CrossBrowserTesting:

     

    You can verify an HREF by using 'Add Expect' and selecting 'Element'. Once you have clicked on the element that contains the HREF, you will see a dialogue open. Change the Expect to 'Attribute' and the Name to 'HREF'.

     

    Usually, the Value will populate with a portion of the URL from the HREF, so I would recommend to paste in the entire link or adjust the 'To' field to Contains.