首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >量角器仅运行Chrome

量角器仅运行Chrome
EN

Stack Overflow用户
提问于 2015-03-31 16:57:07
回答 3查看 6.3K关注 0票数 0

我想使用Firefox和phantomJS而不是chrome来运行量角器测试。但是,只有当我指定'chromeOnly: true‘选项并指定Chrome作为浏览器时,它才会运行。

否则它将崩溃并抛出错误“unable to start Webdriver Session”。

我的量角器配置:

代码语言:javascript
复制
'use strict';

var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;

// An example configuration file.
exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',
  //seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json

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

  baseUrl: 'http://localhost:8000/',

  framework: 'jasmine',

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

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

回答 3

Stack Overflow用户

发布于 2015-04-01 07:09:54

"chromeOnly“选项意味着”直接连接到chrome“(与使用selenium服务器相比)。当您删除该选项时,Protractor期望与selenium服务器通信以控制浏览器。参见https://github.com/angular/protractor/blob/master/docs/server-setup.md

由于火狐现在也支持“直接连接”模式,"chromeOnly“配置选项已重命名为"directConnect”。请参阅https://github.com/angular/protractor/commit/3c048585ac811726d6c6d493ed6d43f6a3570bee

要直接使用火狐,你可以保留错误命名的"chromeOnly“选项设置,或者切换到"directConnect”。或者,您可以通过selenium服务器使用Firefox (这意味着您需要启动selenium服务器,请参阅上面列出的server-setup.md文档)。

票数 2
EN

Stack Overflow用户

发布于 2015-04-01 05:01:39

请注意,将phantomjs与量角器一起使用将被忽略。摘自http://angular.github.io/protractor/#/browser-setup

将phantomjs添加到驱动程序功能中,如果使用本地安装,则包括二进制文件的路径:

代码语言:javascript
复制
capabilities: {
  'browserName': 'phantomjs',

  /* 
   * Can be used to specify the phantomjs binary path.
   * This can generally be ommitted if you installed phantomjs globally.
   */
  'phantomjs.binary.path': require('phantomjs').path,

  /*
   * Command line args to pass to ghostdriver, phantomjs's browser driver.
   * See https://github.com/detro/ghostdriver#faq
   */
  'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
}
票数 1
EN

Stack Overflow用户

发布于 2015-04-01 05:11:18

使用

代码语言:javascript
复制
multiCapabilities : [
            {
            'browserName' : 'chrome',
            'chromeOptions' : {
                'binary' : 'chrome.exe',
                'args' : [],
                'extensions' : []
            },
            {
                'browserName' : 'firefox',
                'chromeOptions' : {
                    'binary' : 'path to firefox.exe',
                    'args' : [],
                    'extensions' : []
            }...
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29364533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档