Navigation

Course Home | Code Examples

So we can open all the popular browsers, now we need to go the websites we are trying to automate.

WebDriver provides us with all the common navigation methods we associate with browsers.
We can find them on the navigate class, Driver.navigate().

To

This is used to navigate to a website, pass in the URL you want to navigate to.

driver.navigate().to("http://google.com");

Back

I rarely use this, but it will act as if you’ve pressed back on the browser.

driver.navigate().back();

Forward

I rarely use this, but it will act as if you’ve pressed forward on the browser.

driver.navigate().forward();

Refresh

I rarely use this, but it will act as if you’ve pressed refresh on the browser.

driver.navigate().refresh();

Next Lesson ➔

Richard Bradshaw's photo
Author

Richard Bradshaw

@FriendlyTester

Software Tester, speaker and trainer at Friendly Testing. BossBoss at Ministry of Testing. Whiteboard Testing creator. Striving to improve the testing craft.

Comments