TestProject Forum

How do I inspect an element and validate the underlying value?

I want to validate the href value of a link.

For example, the first link in the body copy here:

The available standard validations, eg ‘Contains text’ appear to only validate the link text rather than the href itself.

I’ve tried the action ‘Get attribute value’ but I’m not clear how to then validate that value.
Is getting the attribute value enough, as it appears to be retrieving based on the locator set under ‘Element’

Can anybody advise?

Thanks!

Hi,
You can use the Get attribute value like in the example below:
First, find your link and use double-shift to freeze the page:

Then make sure to copy the href value from the attributes menu and copy it to your validation.

Then check your result:

image

Note
Some websites do not use the full URL as their link so make sure to compare in attributes against the href value.

1 Like

Thanks @amit.lacher! This worked perfectly.