【问题标题】:Running Automation test in PhantomJS through Webdriver-IO通过 Webdriver-IO 在 PhantomJS 中运行自动化测试
【发布时间】:2015-12-03 18:50:27
【问题描述】:

我一直在尝试直接通过 mocha、wdio 或 gulp 在 phantomjs 上运行我的测试,但每次测试都会因超时错误而终止。虽然测试在 chrome 和 firefox 上运行完美,但它只是在 phantomjs 中我得到一个错误。我已经在全局和我的项目中安装了 phantom js,但自过去 2 天以来我无法让它工作。

我就是这样测试的

before( function (done) {
    driver = webdriverio.remote({ desiredCapabilities: {
        browserName: 'phantomjs'
    } });

    driver.init(done);
});

链接到我的项目:https://github.com/anarwal/asg...

注意:我在 Windows 上运行测试,这就是问题所在,它们在 MAC 上运行良好

【问题讨论】:

  • 它可以是任何东西。尝试缩小问题所在。截屏并检查哪些步骤失败。目前的问题无法回答。

标签: javascript selenium-webdriver phantomjs webdriver-io


【解决方案1】:

当您使用无头浏览器时,您需要运行 selenium 服务器。

有一个使用javascript Here的很好解释的例子。

【讨论】:

    【解决方案2】:

    您可能会发现 Chimp.js 很有用,因为它很容易让您在本地使用 Chrome 或 FF,但在服务器上使用 PhantomJS。见:http://chimpjs.com/

    Chimp.js 通过“无缝集成 CucumberJS / Mocha、Selenium、WebdriverIO 和 Chai / Jasmine Expect 来协同工作。它旨在消除设置这些工具以很好地协同工作所带来的所有痛苦...... " - 阅读更多:https://chimp.readme.io/docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-29
      • 2013-01-15
      • 2019-09-21
      • 1970-01-01
      • 1970-01-01
      • 2021-10-28
      • 1970-01-01
      • 2020-10-19
      相关资源
      最近更新 更多