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:
driver.get(“http://www.google.com”);
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().forward();
driver.navigate().back();
No comments:
Post a Comment