How to get URLs in a Web Object

Hi everybody!

First of all, congratulations for this powerful tool! I’m learning how to works and use in my work to create some basic scripts :slight_smile:

Well im trying to create a script to recopilate all URLs in a object of the web.
My object cointains: xpath=//I[@class=‘fa fa-bars’]
of the web http://demoaut.katalon.com/

And this is part of the code that im using to get the URLs:

links = WebUI.getAttribute(findTestObject('Object Repository/Test'), 'ref')println(links)

But i dont get any URL and script finish passed.

This is the log:

01-29-2018 05:44:44 PM - [INFO] - Opening browser

01-29-2018 05:44:44 PM - [INFO] - Starting ‘Chrome’ driver

01-29-2018 05:44:44 PM - [INFO] - Action delay is set to 0 seconds

01-29-2018 05:44:47 PM - [INFO] - Navigating browser to: ‘http://demoaut.katalon.com/

01-29-2018 05:44:49 PM - [PASSED] - Browser is opened with url: ‘http://demoaut.katalon.com/

01-29-2018 05:44:49 PM - [END] - End action : openBrowser

01-29-2018 05:44:49 PM - [START] - Start action : maximizeWindow

01-29-2018 05:44:49 PM - [INFO] - Maximizing current window

01-29-2018 05:44:50 PM - [PASSED] - Current window maximized

01-29-2018 05:44:50 PM - [END] - End action : maximizeWindow

01-29-2018 05:44:50 PM - [START] - Start action : Statement - links = com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.getAttribute(com.kms.katalon.core.testobject.ObjectRepository.findTestObject(Object Repository/Test), “ref”)

01-29-2018 05:44:50 PM - [INFO] - Finding Test Object with id ‘Object Repository/Test’

01-29-2018 05:44:50 PM - [INFO] - Checking object

01-29-2018 05:44:50 PM - [INFO] - Checking attribute

01-29-2018 05:44:50 PM - [INFO] - Checking timeout

01-29-2018 05:44:50 PM - [INFO] - Finding web element with id: ‘Object Repository/Test’ located by ‘By.xpath: //I[@class=‘fa fa-bars’]’ in ‘30’ second(s)

01-29-2018 05:44:50 PM - [INFO] - Found 1 web elements with id: ‘Object Repository/Test’ located by ‘By.xpath: //I[@class=‘fa fa-bars’]’ in ‘30’ second(s)

01-29-2018 05:44:50 PM - [INFO] - Getting attribute ‘ref’ of object ‘Object Repository/Test’

01-29-2018 05:44:50 PM - [PASSED] - Attribute ‘ref’ of object ‘Object Repository/Test’ is: ‘null’

01-29-2018 05:44:50 PM - [END] - End action : Statement - links = com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.getAttribute(com.kms.katalon.core.testobject.ObjectRepository.findTestObject(Object Repository/Test), “ref”)

01-29-2018 05:44:50 PM - [START] - Start action : Statement - println(links)

null

01-29-2018 05:44:50 PM - [END] - End action : Statement - println(links)

01-29-2018 05:44:50 PM - [PASSED] - Test Cases/TestLinks

01-29-2018 05:44:50 PM - [END] - End Test Case : Test Cases/TestLinks

How can i do this script to get URLs inside of a web object?

Thanks a lot!

do you want to get the current url then you can try

   currentURL = WebUI.getUrl()

this will store the value of current url in a variable currentURL

kishor sharma said:

do you want to get the current url then you can try

   currentURL = WebUI.getUrl()

this will store the value of current url in a variable currentURL

Thank for the answer @kishor sharma ,

Im trying to get all urls of a web like the function getAllLinksOnCurrentPage BUT JUST the urls in a specific section like footer of a web.

So i thought that if i get the object containing the footer section with urls, i can search this urls with any function.

This is what im trying to do but without success