Earlier, we covered navigating to a page using the “get” command( driver.get("http://www.example.com")) As you’veseen, WebDriver has a number of smaller, task-focused interfaces,and navigation is a useful task. Because loading a page is such afundamental requirement, the method to do this lives on the mainWebDriver interface, but it’s simply a synonym to:
driver.navigate().to("http://www.example.com");
To reiterate: “navigate().to()” and “get()” do exactlythe same thing. One’s just a lot easier to type than the other!
The “navigate” interface also exposes the ability to movebackwards and forwards in your browser’s history:
driver.navigate().forward();driver.navigate().back();
Please be aware that this functionality depends entirely on theunderlying browser. It’s just possible that something unexpectedmay happen when you call these methods if you’re used to thebehaviour of one browser over another.
聯(lián)系客服