What code can I use to click on returned URLs?

Okay so I am able to get ALL links from the Katalon demo page.
What code can I use to click onto each URL to ensure the link works?

WebUI.openBrowser(’’)

WebUI.navigateToUrl(‘http://demoaut.katalon.com’)

list = WebUI.getAllLinksOnCurrentPage(true, [])

println list

Thanks,
Dave

You have a list, loop through the urls you have in your list

WebUI.openBrowser('')WebUI.navigateToUrl('http://demoaut.katalon.com')list = WebUI.getAllLinksOnCurrentPage(true, [])println(list)for (def url : list) {    	//Go to link	WebUI.navigateToUrl(url)	//Wait for it load        WebUI.waitForPageLoad(30)		//Print to console the success of each url visited	println('---URL: ' + url + ' works!---')}

Tested and working for me

1 Like

Thank you Anthony, it works like a charm!

I will make use of Katalon Test Suites so I can email the results to our stake holders.

Cheers,
Dave

1 Like

Hi,

After running the test case a few times I have noticed that ALL URL links on the first page are checked and opened but the URLS on the opened/spawned pages are not checked. Does anyone know of a way to recursively check ALL URLs including those from opened/spawned pages?

You didnt ask for that :wink:
Run another loop inside your loop to do that… Seems a bit of an odd thing to do though, what are you trying to achieve?

Somebody else maybe able to offer a cleaner method of recursively checking the links within links?

Hi Anthony,
The requirement I am testing changed to include crawling to child pages.
The nested loop does seem to be the place to start.

Thanks,
Dave