How can I get the status code of some urls dynamically?


#1

Hello,

I have created an excel file with some urls and I want verify the status code.
I have created a variable inside the test case that retrieves each urls from the excel. How can I get the status code of every urls dynamically (I want to check them to be 200)?

ExcelData data = findTestData('Data Files/Code and Theory/Global menu/url excel')
int rows = data.getRowNumbers()
for (i in 1..rows){
String url = data.getValue(2, i)
WebUI.navigateToUrl(url)

Thanks


#2

You can use Katalon built-in keywords for Web Service mixed with keywords for Web UI testing.

Have a look at WS.verifyResposeStatusCode() :

This should be exactly what you want.