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();
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();



