How do you get the URL of a Test Object?

Hi Guys

I wonder if anybody can help - so I am going to try and make the distinction here because I keep getting the same answers and it not what I’m looking for so here I go to try and word what I am looking for exactly.

I am trying to get the URL of a TEST OBJECT i.e. an element on the page that has a link, I want that link - the one that shows the url in the bottom left hand side of the screen on hover over of the element - NOT the current page url in the address bar which is XYZ = WebUI.getURL() ← NOT this.

I hope I explained that well enough - is anybody able to assist - pls pls

Kind Regards

Hi - although the text may be a URL it is also just text, so advise you to use getText keyword. Or, depending on the page code, you may need to extract a value from an attribute. Or if you wanted multiple links, there is yet another keyword. See links below and decide which suits:

ok - let me check out these options - thank you @Dan_Bown

@Dan_Bown Hi - I have to skip this test for now - don’t know how to get this right - what is happening is the first active tab e.g. has an Href = #1 and this is somehow concatenated to the base URL to create the link I spoke of. this #1 does not appear on the base URL in the address bar - so I have no way currently to verify the active tab - any and all help regarding this seems to be stuck on the browser tab which is not what I am looking for as I am working with tabs on tables within the site itself and not the actual browser.
Can you maybe point me in the right direction for help on working with tabs within the web application itself and not the browser tabs.

Kind Regards

Another method that you can look into is WebUI.getUrl(). This gets the URL of the browser web page.

Href is an attribute, so it would likely be, WebUI.getAttribute(findTestObject(...), "Href"). The getAttribute returns a String that you can use other String function to parse what you need from.
refPart = WebUI.getAttribute(findTestObject(...), "Href")

Hi grylion54

the active tab I speak of is a tab on a table in the web application and not the browser(Chrome tabs etc)

do you perhaps have a way of Identifying the/an active tab within the web application?

Kind Regards

Maybe @Dan_Bown can also help because I am somewhat confused. (I haven’t had my morning coffee yet!) Anyway, if you right-click on the element that you hover over, and select “Inspect”, can you get the HTML of the element? (You may have to do this twice.) And create a xpath to it? And then get the specific Attribute that the “Url” link is in? Once we have this, then we should be able to move forward (I think). If we get the “Url” link, then what is “concatenated” can be broken apart. Am I even in the right ball park?

Let me play around some more I may more than likely find some way to do what i’m trying to do.

Thank you guys so much for taking the time to assist - maybe I am just not good at trying to explain my conundrum. I’m going to take a step back and ponder it some more, feels like i’m trying to hard and overcomplicating.

Kind Regards

WebUI.getAttribute(yourLink, 'href')

@Dan_Bown @grylion54 @mwarren04011990

base URL =

tab href = #1 or #2 or #3 etc

hover over tooltip =
hover over tooltip =

I cannont navigate to either of them - the entire page just redirects back to

base URL =

because they are tabs within a page and not pages themselves

getURL and concatenate the getAttribute href and verifyMatch to the tooltip URL which will be a hardcoded String

above logic does a sort of verification but I cannot navigate to the concatenated URLs

and I cannot seem to verify the tab active status of the above mentioned in application tabs (Not the browser tab status)

I hope this explains my conundrum a bit better

Kind Regards

Try to verify that a tab-specific webelement is present/visible/has X attribute/clickable or in any status that proves that the related tab is active.

Look for WebUI.verifyElement*** keywords

I think you’re describing a Single Page Application. So trying to see a URL may not make sense for testing? What is your script trying to achieve and how will you verify it is correct though? If you can click on some page object and navigate to a page that has the expected content, is that enough?

1 Like

Please show the HTML source code of your target page, and point which portion you want to grasp.

@Dan_Bown @grylion54 @mwarren04011990 @kazurayam @daniel.makra

Thanks I came right - Title added to the active tab content window

click tab - verify title = tab is active and its contents are being displayed.

The concatenation I had to do above to replicate is verification enough of the (hoverover/tooltip) URL

Thank you all for your advice - it has been read and noted for future problem solving.

Have a great day!

1 Like