🏎️Navigation
Last updated
Last updated
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()
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()
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.
get()
and navigate().to()
MethodThe get()
method loads a URL and loads the page, while the navigate().to()
method navigates to a new URL without reloading the page.
The get()
method is typically used to open a new browser window, while the navigate().to()
method is typically used to navigate to a new page within the same browser window.
The get()
method is a part of the WebDriver
interface, while the navigate().to()
method is part of the Options
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.
We can go back to previous page with driver.navigate().back() command.
We can go forward from the current page to the last opened page with driver.navigate().next() command.
We can refresh the webpage with driver.navigate().refresh() command.