Earn Money in 10 days

Selenium Videos

Protractor In Selenium

Livechat

Showing posts with label Difference between driver.get(); and driver.navigate.()to();. Show all posts
Showing posts with label Difference between driver.get(); and driver.navigate.()to();. Show all posts

Friday, 7 November 2014

How to open Browser

How to open a browser??
1.WebDriver driver = new Firefox Driver();
driver.get("http://gmail.com");  
                 or                  
2.WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://gmail.com");

Difference between driver.get("http://gmail.com") and driver.navigate().to("http://gmail.com");

1.driver.get();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. If you need to ensure such pages are fully loaded then you can use waits.
2.driver.navigate to:
History and Location 
Earlier, we covered navigating to a page using the get command (driver.get("http://www.example.com")) As you’ve 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://gmail.com");To reiterate: navigate().to() and get() do exactly the same thing.
The navigate interface also exposes the ability to move backwards and forwards in your browser’s history:driver.navigate().forward(); driver.navigate().back();

Popular Posts

 
subscribe
Subscribe Us
emailSubscribe to our mailing list to get the updates to your email inbox... We can't wait more to have your email in our subscribers email list. Just put your nice email in below box: