量角器在PhantomJS上运行测试

Bodine

我似乎无法通过测试成功获得PhantomJS。我试图将其集成到我的项目中,但是在失败之后,我尝试仅运行基本的Angular Docs示例,但遇到了同样的问题。到目前为止,我的步骤:

  • npm install -g phantomjs
  • phantomjs --webdriver=9515 // ... GhostDriver-Main-在端口9515上运行
  • protractor protractorConf.js

这是与示例中相同的文件,仅具有browserName,并且seleniumAddress端口已更改:

// An example configuration file.
exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:9515',

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'phantomjs'
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['onProtractorRunner.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
  }
};

我收到以下错误消息:

UnknownError: Error Message => 'Detected a page unload event; asynchronous script execution does not work across page loads.'

在github上发现了这个问题,这似乎是相关的。我以为我对他们的brower-setup.md足够了解,可以将其包含在我的beforeEach功能之一中然后我发现这里 ptor无论如何只是包装驱动程序。哇,我知道我在量角器/硒土地上是个菜鸟,但是信噪比令人信服。我真的很想使用PhantomJS来获得性能上的好处,但是在此上浪费更多时间的前景正伤着我的头。如果有问题,我使用的是Windows 7 Enterprise 64位。谢谢!

麦可

从根本上来说,此修复为我解决了相同的问题:

https://github.com/pschwartau/protractor/commit/1eeff8b1b2e3e8f3b7c8152264411f26d4665a07

如此处最初所述:renanmartins的https://github.com/angular/protractor/issues/85#issuecomment-26846255


内部protractor / lib / protractor.js替换

this.driver.get('about:blank');
this.driver.executeScript(
    'window.name = "' + DEFER_LABEL + '" + window.name;' +
    'window.location.href = "' + destination + '"');

  var driver = this.driver;
  this.getCapabilities().then(function (capabilities) {
    if (capabilities.caps_.browserName === 'phantomjs') {
      driver.executeScript('window.name = "' + DEFER_LABEL + '" + window.name;');
      driver.get(destination);
    } else {
      driver.get('about:blank');
      driver.executeScript(
          'window.name = "' + DEFER_LABEL + '" + window.name;' +
          'window.location.href = "' + destination + '"');
    }

    // Make sure the page is an Angular page.
    driver.executeAsyncScript(clientSideScripts.testForAngular, 10).
      then(function(hasAngular) {
        if (!hasAngular) {
          throw new Error('Angular could not be found on the page ' +
              destination);
        }
      });
  });

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

量角器-在不同的浏览器上并行运行多个测试

来自分类Dev

在Browserstack Automate上运行量角器测试

来自分类Dev

如何运行量角器

来自分类Dev

使用phantomjs浏览器运行量角器时,只能运行一次测试

来自分类Dev

交互式测试量角器

来自分类Dev

运行量角器以测试在VS2013 Ultimate上开发的AngularJS应用的最佳方法是什么?

来自分类Dev

量角器运行器和跨浏览器测试

来自分类Dev

运行量角器性能测试时出错

来自分类Dev

重新运行量角器超时或测试失败

来自分类Dev

量角器:测试领域焦点

来自分类Dev

量角器测试中的同步处理

来自分类Dev

量角器:测试引导程序警报

来自分类Dev

在量角器测试上设置chromedriver首选项

来自分类Dev

无法在Internet Explorer 11上运行量角器

来自分类Dev

使用PhantomJS的量角器错误

来自分类Dev

量角器平行运行导致测试失败

来自分类Dev

如何仅在量角器中运行失败的测试

来自分类Dev

量角器如何首先运行登录测试脚本

来自分类Dev

我无法在firefox中运行量角器测试,但在chrome中可以正常运行

来自分类Dev

量角器-打开浏览器,等待,运行测试

来自分类Dev

运行量角器以测试我在VS2013 Ultimate上开发的AngularJS应用的最佳方法是什么?

来自分类Dev

在phantomjs中使用量角器运行angularjs e2e测试时出现问题

来自分类Dev

在量角器硒中运行单个测试

来自分类Dev

量角器-获取正在运行测试的硒节点

来自分类Dev

未通过远程硒服务器上的Jenkins运行量角器测试

来自分类Dev

量角器排序基础测试。登录后运行测试

来自分类Dev

如何在量角器套件下运行测试

来自分类Dev

量角器:For 循环异步运行导致测试运行无效验证

来自分类Dev

量角器 - 测试套件 - 未按顺序运行

Related 相关文章

  1. 1

    量角器-在不同的浏览器上并行运行多个测试

  2. 2

    在Browserstack Automate上运行量角器测试

  3. 3

    如何运行量角器

  4. 4

    使用phantomjs浏览器运行量角器时,只能运行一次测试

  5. 5

    交互式测试量角器

  6. 6

    运行量角器以测试在VS2013 Ultimate上开发的AngularJS应用的最佳方法是什么?

  7. 7

    量角器运行器和跨浏览器测试

  8. 8

    运行量角器性能测试时出错

  9. 9

    重新运行量角器超时或测试失败

  10. 10

    量角器:测试领域焦点

  11. 11

    量角器测试中的同步处理

  12. 12

    量角器:测试引导程序警报

  13. 13

    在量角器测试上设置chromedriver首选项

  14. 14

    无法在Internet Explorer 11上运行量角器

  15. 15

    使用PhantomJS的量角器错误

  16. 16

    量角器平行运行导致测试失败

  17. 17

    如何仅在量角器中运行失败的测试

  18. 18

    量角器如何首先运行登录测试脚本

  19. 19

    我无法在firefox中运行量角器测试,但在chrome中可以正常运行

  20. 20

    量角器-打开浏览器,等待,运行测试

  21. 21

    运行量角器以测试我在VS2013 Ultimate上开发的AngularJS应用的最佳方法是什么?

  22. 22

    在phantomjs中使用量角器运行angularjs e2e测试时出现问题

  23. 23

    在量角器硒中运行单个测试

  24. 24

    量角器-获取正在运行测试的硒节点

  25. 25

    未通过远程硒服务器上的Jenkins运行量角器测试

  26. 26

    量角器排序基础测试。登录后运行测试

  27. 27

    如何在量角器套件下运行测试

  28. 28

    量角器:For 循环异步运行导致测试运行无效验证

  29. 29

    量角器 - 测试套件 - 未按顺序运行

热门标签

归档