在 Geb 测试中,我想在浏览器的历史记录中导航回来(即单击浏览器的后退按钮)。我还没有找到使用 Geb API 执行此操作的方法。
我所做的是:
driver.navigate().back() // usage of WebDriver API
browser.page(<<previous Page class>>) // this tells Geb that the page has changed
代码可以工作,但我不喜欢这里使用 WebDriver API。另一个想法是用 JavaScript 来完成,但这也是我想避免的。
有没有一种更 Gebish 的方式来返回浏览器的历史记录?
最佳答案
我相信没有。我还会使用 WebDriver API 来导航回来。有时需要使用WebDriver API,这就是为什么WebDriver实例暴露在Geb的Browser类上。
关于groovy - 如何在 Geb 测试中导航回浏览器历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21490641/