如何在Geb测试中浏览浏览器的历史记录

时间:2014-01-31 21:46:15

标签: groovy automated-tests geb

在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方式导航?

1 个答案:

答案 0 :(得分:5)

我相信没有。我还会使用WebDriver API导航回来。有时需要使用WebDriver API,这就是为什么WebDriver实例在Geb的Browser类上公开。