PAGE 20 : DIFFERENCE BETWEEN webdriver.get() and webdriver.navigate() IN SELENIUM WEBDRIVER

Difference between webdriver.get() and webdriver.navigate() in selenium Webdriver





There are two methods in selenium webdriver to navigate page

1.driver.get(“URL”)



The first thing you’ll want to do with WebDriver is navigate to a page. The normal way to do this is by calling get:
Webdriver will wait until the page has fully loaded before returning the control to test or script. If there many ajax calls in the current page which webdriver is loading then webdriver may not know when it has loaded completely. If you need to make sure such pages are fully loaded then you can use waits.

Earlier, we covered navigating to a page using the get command (driver.get(“http://www.google.com“)) As you have seen, webdriver has a number of smaller, task-focused interfaces, and navigation is a useful task. Because loading a page is such a fundamental requirement, the method to do this lives on the main Webdriver interface, but it’s simply a synonym to:
driver.navigate().to(“http://www.google.com“);
navigate().to() and get() do exactly the same thing. One’s just a lot easier to type than the other!
The navigate interface also has the ability to move backwards and forwards in your browser’s history:

driver.navigate().refresh();
driver.navigate().forward();
driver.navigate().back();

No comments:

About Me

My photo
Pune, Maharastra, India
You can reach me out at : jimmiamrit@gmail.com