When to use driver.get() and driver.navigate().to() for URL opening in Selenium WebDriver

Описание к видео When to use driver.get() and driver.navigate().to() for URL opening in Selenium WebDriver

driver.get() and driver.navigate().to(), both navigate to the given webpage. From the link given in the answer, it can be concluded that:

navigate().to() and get() do exactly the same thing.

But, here is a scenario that you gave which explains the difference, ie. Single-Page Applications.

The difference between these two methods comes not from their behavior, but from the behavior in the way the application works and how browser deal with it.

navigate().to() navigates to the page by changing the URL like doing forward/backward navigation.

Whereas, get() refreshes the page to changing the URL.

So, in cases where application domain changes, both the method behaves similarly. That is, page is refreshed in both the cases. But, in single-page applications, while navigate().to() do not refreshes the page, get() do.

If you would like to hear about latest videos about test automation tools like Selenium WebDriver, TOSCA TestSuite, API Test Automation using restAssued etc. please dont forget to visit & subscribe to my youtube channel at url:

https://www.youtube.com/c/AutomationT...

Комментарии

Информация по комментариям в разработке