Protractor 在error.js中获取错误

Protractor 在error.js中获取错误,protractor,Protractor,我在error.js中收到一个错误-在repo下 Appdata\Roaming\npm\node\u modules\dragor\node\u modules\selenium webdriver\error.js 我得到的错误是: 超级(选择错误){ “WebDriverError:必须通过webdriver.chrome.driver系统属性设置驱动程序可执行文件的路径;” 我只创建了两个文件,一个是conf.js,另一个是test_spec.js 测试规范js describe('an

我在error.js中收到一个错误-在repo下

Appdata\Roaming\npm\node\u modules\dragor\node\u modules\selenium webdriver\error.js

我得到的错误是:

超级(选择错误){

“WebDriverError:必须通过webdriver.chrome.driver系统属性设置驱动程序可执行文件的路径;”

我只创建了两个文件,一个是conf.js,另一个是test_spec.js

测试规范js

describe('angularjs homepage', function() {
  it('should have a title', function() {
    browser.get('http://angular.org/');

    expect(browser.getTitle()).toContain('AngularJS');
  });
});
exports.config = {
    //The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',
  //Here we specify the name of the specs files.
  specs: ['test_spec.js']
}
conf.js

describe('angularjs homepage', function() {
  it('should have a title', function() {
    browser.get('http://angular.org/');

    expect(browser.getTitle()).toContain('AngularJS');
  });
});
exports.config = {
    //The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',
  //Here we specify the name of the specs files.
  specs: ['test_spec.js']
}

我想在这里提到,根据我的config.json,我在selenium文件夹下有所有需要的文件,即chromedriver.exe、chromedriver_2.21.zip和selenium-server-standalone-2.53.0,但我仍然收到了这个错误。

请按照以下步骤检查是否解决了您的问题

打开端子并输入以下命令

1.npm install -g protractor
2.webdriver-manager update
3.webdriver-manager start
4.protractor  path-to-config.json file

尝试使用这个dragrator.conf.js

 exports.config = {
  framework: 'jasmine2',

  seleniumAddress: 'http://localhost:4444/wd/hub',

  specs: ['spec/**/*[sS]pec.js'],
/*
 * If u want to use only one browser
  capabilities: {
    "browserName": "chrome"
  },


   * By this you can use multiBrowser
   *
   */

  multiCapabilities:[
    {
      'browserName' : 'chrome'
    },
    /*{
      'browserName' : 'firefox'
    },
    {
      'browserName' : 'internet explorer',
      'platform' : 'ANY',
      'version' : '11'
    },
    {
      'browserName' : 'phantomjs'
    },
    */
  ],
  /*
  * Force protractor to use only one browser at a time
  */
  maxSessions: 1,
  allScriptsTimeout: 60000,

  jasmineNodeOpts: {
    defaultTimeoutInterval: 360000,
    showTiming: true,
    isVerbose:true,

  },

  onPrepare: function () {
    /*
     Set browser window size
     */
    browser.driver.manage().window().setSize(1920, 1080);


  },

  /*
   Set your app's main URL here, so you can use relative urls along the tests
   */
  baseUrl: 'http://url_to_app.com',

};

已经安装了,但仍然出现相同的错误。您编写的步骤是默认的安装步骤。\[在这里您可以找到解决问题的其他解决方案