1
votes

I am trying to follow the tutorial at https://docs.angularjs.org/tutorial and have an error running the command

npm run protractor

Here is the console log:

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\GIT\angular-practices\angular-phonecat>npm run protractor

[email protected] preprotractor C:\GIT\angular-practices\angular-phonecat npm run update-webdriver

[email protected] preupdate-webdriver C:\GIT\angular-practices\angular-phonecat npm install

[email protected] postinstall C:\GIT\angular-practices\angular-phonecat bower install

[email protected] update-webdriver C:\GIT\angular-practices\angular-phonecat webdriver-manager update

selenium standalone is up to date. chromedriver is up to date.

[email protected] protractor C:\GIT\angular-practices\angular-phonecat protractor test/protractor-conf.js

util.puts: Use console.log instead Using ChromeDriver directly... Error: spawn UNKNOWN at exports._errnoException (util.js:746:11) at ChildProcess.spawn (child_process.js:1162:11) at exports.spawn (child_process.js:995:9) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:173:23 at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\prom ise.js:1539:20) at notify (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:362:12) at [object Object].then (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:414:7) at Object.webdriver.promise.when (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:639:18) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:172:20 ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession_ (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:49) at Function.webdriver.WebDriver.createSession (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:111:30) at Object.createDriver (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:460:30) at ChromeDriverProvider.getDriver (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\lib\driverProviders\chrome.js:67:27) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\lib\runner.js:221:35 at _fulfilled (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:797:54) at self.promiseDispatch.done (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:826:30) at Promise.promise.promiseDispatch (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:759:13) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:525:49

Can you tell me where the problem is?

Here is my protractor conf.js:

exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    'e2e/*.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  chromeOnly: true,

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

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};
2
can you post your protractor conf.js fileMalik

2 Answers

4
votes

For those who are on a Mac and getting this error, the following open issue can cause this: https://github.com/angular/webdriver-manager/issues/476

The solution is provided by ciekawy. In

node_modules/webdriver-manager/built/lib/files/file_manager.js or

node_modules/protractor/webdriver-manager/built/lib/files/file_manager.js

add the following code at line 166:

fileUrl.url = fileUrl.url.replace(/_m1/, '');

You will then need to update the chrome drivers to pick up the change. If using NRWL's NX monorepo management tools:

npx webdriver-manager clean
npx webdriver-manager update --gecko=false --versions.chrome=<version from chrome://versions>
0
votes

in your conf.js file change to chromeOnly: false

exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    'e2e/*.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  chromeOnly: false,

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

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};

similer issue you can find here #176