Using Watir-webdriver how to check the URL of a page
Asked Answered
C

1

11

I am new to watir-webdriver automation, apologies if its a basic question of automation. But the thing is I am automating pagination of a website where the URL of the website changes as the user changes the page say the URL is www.example.co.uk/news which has pagination when the user clicks next button on the pagination the URL changes to www.example.co.uk/news?page=1

I want to check the URL at this point to see if the URL is correct. But I can't really find a way to get the URL of the current page.

Corroboration answered 21/2, 2012 at 15:49 Comment(0)
P
17

browser.url will return url of the page, so to check if it is as expected, try something like this:

browser.url == "www.example.co.uk/news?page=1"

It will return true or false.

Pecuniary answered 21/2, 2012 at 16:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.