Monday 22 July 2013

Selenium :- What is the difference between get() and navigate() methods


get("http://www.google.com") -  navigate to a Web page. WebDriver will wait until the page has fully loaded (that is, the onload event has fired) before returning control to your test or script. It’s worth noting that if your page uses a lot of AJAX on load then WebDriver may not know when it has completely loaded. 

Navigation().to("http://www.google.com") : It also navigate to a web page.

Conclusion :- navigate().to() and get() do exactly the same thing. One's just a lot easier to type than the other. The navigate interface also provides the ability to move backwards and forwards in your browser’s history:

  1.     driver.navigate().forward();
  2.     driver.navigate().back();


No comments:

Post a Comment