Selenium 2(WebDriver) 还是 Geb?

发布于 2024-11-07 12:03:58 字数 173 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

誰認得朕 2024-11-14 12:03:58

在我们的工作场所使用 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.

往日情怀 2024-11-14 12:03:58

从我的经验来看,Geb 没有任何问题,但我会扩大搜索范围,包括一些来自 Rubyland 的最新驱动程序。 Webrat 是一个很好的入门者,但是Capybara 实际上相当优秀。

它更多地采用元方​​法,并为多个不同的驱动程序提供统一的 API,包括 Selenium 和无头替代方案例如 HtmlUnitenv.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.

最初的梦 2024-11-14 12:03:58

我用过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.

梦归所梦 2024-11-14 12:03:58

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.

ぃ弥猫深巷。 2024-11-14 12:03:58

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.

月朦胧 2024-11-14 12:03:58

Ghostdriver 现在可供 Selenium 爱好者使用。以下是如何将其与 Geb 一起使用。

Maven-

<dependency>
    <groupId>com.github.detro.ghostdriver</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.1.0</version>
    <scope>test</scope>
</dependency>

GebConfig-

// your path to phantomjs binary
phantombinary = "/Users/kruttik.aggarwal/phantomjs-1.9.7-macosx/bin/phantomjs" 

driver = {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setJavascriptEnabled(true);
    caps.setCapability(
        PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
        phantombinary
    );

    // Launch driver (will take care and ownership of the phantomjs process)
    WebDriver driver = new PhantomJSDriver(caps);
    System.out.println("starting driver");
    driver
}

Ghostdriver is now available for Selenium lovers. Here's how you can use it with Geb.

Maven-

<dependency>
    <groupId>com.github.detro.ghostdriver</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.1.0</version>
    <scope>test</scope>
</dependency>

GebConfig-

// your path to phantomjs binary
phantombinary = "/Users/kruttik.aggarwal/phantomjs-1.9.7-macosx/bin/phantomjs" 

driver = {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setJavascriptEnabled(true);
    caps.setCapability(
        PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
        phantombinary
    );

    // Launch driver (will take care and ownership of the phantomjs process)
    WebDriver driver = new PhantomJSDriver(caps);
    System.out.println("starting driver");
    driver
}
帅气称霸 2024-11-14 12:03:58

您还可以看看 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文