In this post, we will dive into what webdriver API does in terms of navigation. Selenium Webdriver Navigation is the first part of Webdriver API and we will cover all navigation methods such as .get(<url>), .navigate.to, .navigate.back(), .navigate.forward(), etc…

Audience

This post is designed for beginners who have little or no automation experience. At the end of this tutorial, you will have knowledge of Selenium Navigation features.

Selenium Webdriver Navigation Methods

Webdriver Navigation methods are shown below figure. In this post, I will go with method explanations then show their examples and usage.

navigation

.get (URL)

We can go to any URL with driver.get(“http://www.yahoo.com”) command.

.navigate.to(url)

We can go to any URL with driver.navigate().to(“http://www.yahoo.com”) command.

.navigate.back()

We can go back to previous page with driver.navigate().back() command.

.navigate.forward()

We can go forward from current page to last opened page with driver.navigate().next() command.

.navigate.refresh()

We can refresh the webpage with driver.navigate().refresh() command.

Webdriver Navigation Example

Pom.xml

Important Note:
Navigation of webdriver halts until the HTML of the page is fully loaded but javascript is not included in this context. Thus, in some cases synchronization is required for error-prone manipulation and interrogation.

Selenium Webdriver Tutorial Series