What is the difference between get()
and navigate()
methods?
Does any of this or maybe another method waits for page content to load?
What do I really need is something like Selenium 1.0's WaitForPageToLoad
but for using via webdriver
.
Any suggestions?
Otherwise you prob want the get method:
Navigate allows you to work with browser history as far as i understand it.
To get a better understanding on it, one must see the architecture of Selenium WebDriver.
Just visit https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
and search for "Navigate to a new URL." text. You will see both methods GET and POST.
Hence the conclusion given below:
driver.get() method internally sends Get request to Selenium Server Standalone. Whereas driver.navigate() method sends Post request to Selenium Server Standalone.
Hope it helps
navigate().to() and get() will work same when you use for the first time. When you use it more than once then using navigate().to() you can come to the previous page at any time whereas you can do the same using get().
Conclusion: navigate().to() holds the entire history of the current window and get() just reload the page and hold any history.
driver.get(url)
andnavigate.to(url)
both are used to go to particular web page. The key difference is thatdriver.get(url)
: It does not maintain the browser history and cookies and wait till page fully loaded.driver.navigate.to(url)
:It is also used to go to particular web page.it maintain browser history and cookies and does not page fully loaded and have navigation between the pages back, forward and refresh.driver.get()
: It's used to go to the particular website , But it doesn't maintain the browser History and cookies so , we can't use forward and backward button , if we click on that , page will not get scheduledriver.navigate()
: it's used to go to the particular website , but it maintains the browser history and cookies, so we can use forward and backward button to navigate between the pages during the coding of TestcaseBoth perform the same function but driver.get(); seems more popular.
driver.navigate().to();
is best used when you are already in the middle of a script and you want to redirect from current URL to a new one. For the sake of differentiating your codes, you can usedriver.get();
to launch the first URL after opening a browser instance, albeit both will work either way.