groovy - 如何在 Geb 测试中导航回浏览器历史记录

标签 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 的方式来返回浏览器的历史记录?

最佳答案

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

关于groovy - 如何在 Geb 测试中导航回浏览器历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21490641/

相关文章:

datetime - Groovy - 惯用的编码方式最后一个工作日 - 月初

java - 使用 Selenium 上传 APK 文件

java - geb.driver.DriverCreationException : failed to create driver from callback

vb.net - Mercury Quick Test Pro 和虚拟机 : Works from one client machine but not another

testing - 文件下载超时

grails - 我无法使用 Geb 和 spock 运行简单的 Grails 功能测试

jquery - 如何通过geb测试select2

Python 的 os.path 库等同于 Groovy

jenkins - (字符串问题)如何使用数据字符串进行curl POST 调用?

java - 是否可以将包中的所有类注册为 Spring bean