Navigation: History and LocationEarlier, we covered navigating to a page using the “get” command ( driver.get("http://www.")) 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://www."); To reiterate: “navigate().to()” and “get()” do exactly the same thing. One’s just a lot easier to type than the other! The “navigate” interface also exposes the ability to move backwards and forwards in your browser’s history: driver.navigate().forward(); driver.navigate().back(); Please be aware that this functionality depends entirely on the underlying browser. It’s just possible that something unexpected may happen when you call these methods if you’re used to the behaviour of one browser over another. |
|
来自: 昵称9ou9g > 《selenium2》