Verify output web url

How can i verify output url, as url cannot be captured as an object through spy object,
For e.g
from home page of website i.e (abcd.com) if i click on logo which redirects to i.e. (https://flipkart.com) now i want to verify url whether it redirected to correct flipkart website.

You get the current URL as String by “WebUI.getUrl()”

So, your test case can do :

  1. open your website (abcd.com)
  2. click on logo
  3. browser would naviate to another url
  4. get the current URL string by WebUI.getUrl()
  5. verify if the string equals to what you expect (“https://flipart.com”)
  6. go back to the home page by WebUI.back()
1 Like

Hey I tried this but it’s fetching the previous page url and not the current one any idea how i can fix it ?
Im doing this now :slight_smile:

WebUI.openBrowser(‘https://techcrunch.com/events/’, FailureHandling.CONTINUE_ON_FAILURE)

def btnSrc = WebUI.getAttribute(findTestObject(‘Page_Events/a_Be a Sponsor’), ‘href’)

WebUI.click(findTestObject(‘Page_Events/a_Be a Sponsor’))

WebUI.waitForPageLoad(0)

String url = WebUI.getUrl()

WebUI.verifyEqual(url, btnSrc)

So i realised i was not switching the window index that was the problem.
But now one more issue is that the url is appended with some numbers since its opened with katalon how do i remove that now ?

Too little information…

Please have a look at the following post and provide more info about your problem: