How to verify navigated URL

I want to verify navigated URL is correct or not. let’s say i’m in “ is for sale |” . after login i want to verify whether i’m in correct landing page or not by comparing above URL with “ is for sale |” . Is there any way to do that?

1 Like

Hi @Russ_Thomas… Thanks for replying. I used this one

url = WebUI.getUrl()
url1 =''
	println('you are in correct page')

But always test is passed after changing the url1 to wrong one… Why is that?


Your code will print some messages, that’s all it does. Your code will always pass because it has no assertion statement. If you want it to fail in case, you need to write some assertion statements.

The following example uses Groovy’s assert statement. This is the most concise assertion method. The assert statement may let the test case fail and emit message to the Console, but will not show message in the Log Viewer.

assert WebUI.getUrl() == ''

Or, if you would like to see message in the Kalalon Log Viewer, use WebUI.equal() keyword:

def url = WebUI.getUrl()
WebUI.verifyEqual(url, '')

@kazurayam Couldn’t that give a false-positive or by throwing that exception, katalon shows failed step?

1 Like

I changed my previous reply.

yeah…it works…Thanks @kazurayam