Selenium 2(WebDriver) 还是 Geb?
Web 驱动程序和页面对象模式给我留下了深刻的印象。最近我看到 Geb 框架并与 spock 框架组合似乎是一个强大的替代选择自动化测试。有人用Geb吗?您认为 Geb 有什么局限性吗?
I am very much impressed with web driver and page object pattern. Recently I saw Geb framework and with spock framework combination seems to be like a powerful alternate option for automated tests. Is anyone one using Geb? Do you think of any limitations of Geb?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
在我们的工作场所使用 Geb 成了我们的救星。我无法想象这么多人(完全没有编程背景)在这么短的时间内学习 Selenium。
我非常成功地创建了 mavenized geb 项目,我们在 Jenkins 上为我们的 CI 运行这些项目。它确实有一些限制,例如不具有开箱即用的拖放功能。但是,只要需要,您始终可以自由使用 Selenium API。另外,对于评论者说它缺乏对 phantomJS 的支持 - 谁说的?您绝对可以使用 selenium 支持的任何驱动程序。检查此链接了解详情。
Using Geb at our workplace has been a life-saver. I can't imagine this many people (with absolutely no programming background) picking up Selenium in as short a time span.
I've been very successful creating mavenized geb projects that we have running on Jenkins for our CI. It does have a few limitations like not having the drag and drop ability right out of the box. However, you are always free to use the Selenium APIs whenever the need arises. Also, to the commenter about it lacking the support for phantomJS - says who? You can use absolutely any driver that selenium supports. Check this link for details.
从我的经验来看,Geb 没有任何问题,但我会扩大搜索范围,包括一些来自 Rubyland 的最新驱动程序。 Webrat 是一个很好的入门者,但是Capybara 实际上相当优秀。
它更多地采用元方法,并为多个不同的驱动程序提供统一的 API,包括 Selenium 和无头替代方案例如 HtmlUnit 或 env.js。
感谢 JRuby,使用 Ruby 操作系统编写的库现在变得非常容易。
There's nothing wrong with Geb from what I have experienced, but I would widen the search to include some of the recent(ish) drivers coming from Rubyland. Webrat was a great starter, but Capybara is actually quite excellent.
It takes more of a meta-approach, and provied a unified API for several different drivers, including Selenium and head-less alternatives such as HtmlUnit or env.js.
Thanks to JRuby, using libraries written in Ruby os now quite easy.
我用过Geb框架。它是基于 Groovy 的自动化框架。我在创建常见的可重用方法和常见的页面方法时遇到了问题。
I have used Geb framework. It is groovy based automation framework. I had issues with creating common reusable methods and common page methods.
Geb 在 Groovy 中运行 WebDriver。它看起来很酷,并且使 WebDriver 变得更容易。
如果您直接使用 WebDriver,则可以从 语言的数量。
Geb runs WebDriver in Groovy. It looks pretty cool and make make WebDriver easier.
If you use WebDriver directly, you can pick from a number of languages.
Geb 很棒,唯一缺少的是像 phantomJS 这样的现代无头驱动程序的支持。有一个名为 Ghostdriver 的项目,但尚未准备就绪。总的来说,我喜欢使用 Spock 和 Geb,它改变了我们在工作中开发 Web 应用程序的方式。
Geb is great, the only thing lacking is the support of a modern headless driver like phantomJS. There is a project named Ghostdriver but it isn't ready yet. Overall, I am loving using Spock and Geb and it's a game changer on how we develop our web apps at work.
Ghostdriver 现在可供 Selenium 爱好者使用。以下是如何将其与 Geb 一起使用。
Maven-
GebConfig-
Ghostdriver is now available for Selenium lovers. Here's how you can use it with Geb.
Maven-
GebConfig-
您还可以看看 Selenide,它是 Selenium 的一个非常简洁的包装器:https://stackoverflow.com/a/43202999/ 4717152
You may also have a look at Selenide, which is a very concise wrapper over Selenium: https://stackoverflow.com/a/43202999/4717152