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

get()
Method
get()
MethodThe get()
method is used to open a URL in the current browser window. When you call the get()
method, the browser will navigate to the specified URL and load the page.
navigate().to()
Method
navigate().to()
MethodThe navigate().to()
method is used to navigate to a new URL in the current browser window. When you call the navigate().to()
method, the browser will navigate to the new URL, but it will not reload the page.
Differences between get()
and navigate().to()
Method
get()
and navigate().to()
MethodThe
get()
method loads a URL and loads the page, while thenavigate().to()
method navigates to a new URL without reloading the page.The
get()
method is typically used to open a new browser window, while thenavigate().to()
method is typically used to navigate to a new page within the same browser window.The
get()
method is a part of theWebDriver
interface, while thenavigate().to()
method is part of theOptions
interface.
In summary, the get()
method and navigate().to()
method are both used to navigate to a URL, but they have different functionalities. The get()
method will load the page while the navigate().to()
method will not reload the page.
.navigate.back()
We can go back to previous page with driver.navigate().back() command.
.navigate.forward()
We can go forward from the current page to the last opened page with driver.navigate().next() command.
.navigate.refresh()
We can refresh the webpage with driver.navigate().refresh() command.
Last updated
Was this helpful?