Search code examples
seleniumweb-testing

How do you use Selenium to test if your URL is what is expected?


I'm currently learning Selenium 1.8.0, and I'd like to test whether the current URL is what I want.

I know there's a storeLocation function, but I'm not sure what else I need to do.

thanks!


Solution

  • selenium.getLocation() will give you the current URL in the address bar. Since you said you are learning - It would be better you learn Selenium 2 rather than selenium 1.x versions. Reasons are mentioned here

    Obvious reason to move from Selenium RC to Webdriver.?