driver get vs driver navigateto
Actually, two methods are doing same thing with small differences,
but driver.get() method is a convenient way.
driver.get("http://www.google.com");
If you use this method for opening URL, it will wait until the page has
fully loaded, that means every element in the page gets loaded before
returning control to your test or script. It only opens the url, but
driver.navigateto() interface also exposes the ability to move
backwards and forwards in browser’s history.
driver.navigate().to("http://www.google.com");
If we use navigate(to) method to open URL, it will not wait until the
whole page get loaded
The differences:
1.driver.get(url) does not maintain the browser history and cookies
whereas driver.navigate.to(url) maintains browser history and
cookies.
2. driver.get(url) wait till the page fully loaded
driver.navigate.to(url) does not.
3. We cannot move forward/backward between the pages with
driver.get() but we can navigate between the pages back, forward
and refresh with driver.navigate()