Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protractor 3.2.2 directconnect to npm:chromedriver fails on Windows 8 with ENOENT #3069

Closed
kylezeeuwen opened this issue Mar 29, 2016 · 8 comments

Comments

@kylezeeuwen
Copy link

Bug report

  • Node Version: v5.3.0
  • Protractor Version: 3.2.2
  • Browser(s): Chrome 48.0.2564.116
  • Operating System and Version Windows 8.1 Enterprise
  • Your protractor configuration file
exports.config = {
  directConnect: true,
  chromeDriver: 'node_modules/chromedriver/bin/chromedriver',
  specs: [ 'features/*.feature' ],
  capabilities: {
    browserName: 'chrome',
    platform: 'ANY',
    chromeOptions: {
      args: ['--test-type']
    }
  }
}
  • A relevant example test
$ node node_modules/protractor/bin/protractor protractor-conf.js --troubleshoot
  • Output from running the test
DEBUG - Running with --troubleshoot
DEBUG - Protractor version: 3.2.1
DEBUG - Your base url for tests is http://192.168.99.100/
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Error: spawn C:\Users\jwarr\workspace\console-web\node_modules\chromedriver\bin\chromedriver ENOENT
    at exports._errnoException (util.js:855:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:455:9)
    at process._tickCallback (node.js:369:17)
[launcher] Process exited with error code 1
  • Steps to reproduce the bug

Easy to preproduce on Windows with a minimal set of files:

  • package.json
  • protractor-conf.js
  • features/testFeature.feature

package.json:

{
  "name": "protractor-test",
  "version": "1.0.0",
  "description": "debugging protractor bug",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chromedriver": "^2.21.2",
    "protractor": "^3.2.2"
  }
}

protractor-conf.js is provided above

features/testFeature.feature is a copy of https://github.com/angular/protractor/blob/master/example/example_spec.js

Steps:

  1. npm install
  2. node node_modules/protractor/bin/protractor protractor-conf.js --troubleshoot

OP Notes

Apologies if this is actually a selenium-webdriver issue.

I think that this bug is occurring because node childProcess.spawn has issues on Windows.

I noticed that a recent protractor checkin to the protractor build chain addresses a similar issue : a79fd29

To debug the issue I followed the instructions in this post and http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js and registered the spawn wrapper in protractor-conf.js. This was the output:

{ '0': 'C:\\Users\\jwarr\\workspace\\console-web\\node_modules\\chromedriver\\bin\\chromedriver',
  '1': [ '--port=63344' ],
  '2':
   { env:
      { ALLUSERSPROFILE: 'C:\\ProgramData',
        APPDATA: 'C:\\Users\\jwarr\\AppData\\Roaming',
        CommonProgramFiles: 'C:\\Program Files\\Common Files',
        'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
        CommonProgramW6432: 'C:\\Program Files\\Common Files',
        COMPUTERNAME: 'BNEDEVD002',
        ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe',
        DOCKER_CERT_PATH: 'C:\\Users\\jwarr\\.docker\\machine\\machines\\default',
        DOCKER_HOST: 'tcp://192.168.99.100:2376',
        DOCKER_MACHINE_NAME: 'default',
        DOCKER_TLS_VERIFY: '1',
        DOCKER_TOOLBOX_INSTALL_PATH: 'C:\\Program Files\\Docker Toolbox',
        FP_NO_HOST_CHECK: 'NO',
        HOMEDRIVE: 'C:',
        HOMEPATH: '\\Users\\jwarr',
        JAVA_HOME: 'C:\\Program Files\\Java\\jdk1.7.0_79',
        LOCALAPPDATA: 'C:\\Users\\jwarr\\AppData\\Local',
        LOGONSERVER: '\\\\BNEDC003',
        NODE_ENV: 'test',
        NUMBER_OF_PROCESSORS: '8',
        OS: 'Windows_NT',
        Path: 'C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\AMD\\ATI.ACE\\Core-Static;C:\\Program Files\\nodejs\\;C:\\Users\\jwarr\\.dnx\\bin;C:\\Program Files\\Microsof
t DNX\\Dnvm\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Python\\Python35-32\\Scripts\\;C:\\Python27\\;C:\\Users\\jwarr\\AppData\\Roaming\\npm;C:\\Users\\jwarr\\AppData\\Local\\Atlassian\\SourceTree\\git_local\\bin\\;C:\\Program Files\\Docker Toolbox;C:\\Users\\jwa
rr\\AppData\\Local\\atom\\bin',
        PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC',
        PROCESSOR_ARCHITECTURE: 'AMD64',
        PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',
        PROCESSOR_LEVEL: '6',
        PROCESSOR_REVISION: '3c03',
        ProgramData: 'C:\\ProgramData',
        ProgramFiles: 'C:\\Program Files',
        'ProgramFiles(x86)': 'C:\\Program Files (x86)',
        ProgramW6432: 'C:\\Program Files',
        PROMPT: '$P$G',
        PSModulePath: 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\;c:\\Program Files\\Microsoft Security Client\\MpProvider\\',
        PUBLIC: 'C:\\Users\\Public',
        SESSIONNAME: 'Console',
        SystemDrive: 'C:',
        SystemRoot: 'C:\\WINDOWS',
        TEMP: 'C:\\Users\\jwarr\\AppData\\Local\\Temp',
        TMP: 'C:\\Users\\jwarr\\AppData\\Local\\Temp',
        UATDATA: 'C:\\WINDOWS\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77',
        USERDNSDOMAIN: 'CONSOLE.COM.AU',
        USERDOMAIN: 'CONSOLE',
        USERDOMAIN_ROAMINGPROFILE: 'CONSOLE',
        USERNAME: 'jwarr',
        USERPROFILE: 'C:\\Users\\jwarr',
        VBOX_MSI_INSTALL_PATH: 'C:\\Program Files\\Oracle\\VirtualBox\\',
        VS140COMNTOOLS: 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\',
        windir: 'C:\\WINDOWS' },
     stdio: 'ignore' } }

Workaround

Apply the following conditional in your protractor-conf.js config:

chromeDriverPath = process.platform === 'win32' ? 'node_modules/chromedriver/lib/chromedriver/chromedriver.exe' : 'node_modules/chromedriver/bin/chromedriver';

exports.config = {
  directConnect: true,
  chromeDriver: chromeDriverPath,
  specs: [
    'features/*.feature'
  ],
  capabilities: {
    browserName: 'chrome',
    platform: 'ANY',
    chromeOptions: {
      args: ['--test-type']
    }
  }
}

@cnishina
Copy link
Member

Yes, 3.2.1 has a hot fix. Please use 3.2.2, run webdriver-manager clean and webdriver-manager update

@kylezeeuwen
Copy link
Author

Hi @cnishina , thanks for your reply.

I was having this issue when using protractor 3.2.2.

Given I was using directConnect and providing the path to chromeDriver I shouldn't have to run webdriver-manager commands ?

@cnishina
Copy link
Member

Oh cool, you're online, if you are using directConnect, the chromeDriver per the reference docs is used for the selenium jar. https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L47

@cnishina
Copy link
Member

Also, maybe the example conf.js could provide some clarity, no chromedriver needs to be specified. https://github.com/angular/protractor/blob/master/example/conf.js

@kylezeeuwen
Copy link
Author

ya I'm in AU so not too late ;)

Looking at the referenceConf.js doc you referenced, I interpret line 88-90 as saying "if I am using directConnect, then I need to specify chromeDriver https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L89

IMO A small update to those lines that mentions the default behaviour would help, although I didn't know that file was available until now (related doc issue: how to find that really helpful referenceConf.js ?) !

I've just rerun to confirm the use of default paths. Note I do not have access to the windows box ATM.
You are right on OSX/Linux that the chromeDriver setting is not necessary IF directConnect is true and IF I have run webdriver-manager update.

I will confirm the behaviour on windows tomorrow and post an update.

@cnishina
Copy link
Member

Also this may help: https://github.com/angular/protractor/blob/master/lib/driverProviders/direct.js#L53

If you are using 3.2.1, it will use the download the zip file and unzip it as chromedriver_2.21 to the selenium directory; however, because there is no .exe file type, it will not launch the driver. So turns out the initial suggestion to do a webdriver-manager clean and webdriver-manager update will probably solve this problem.

@cnishina cnishina self-assigned this Mar 29, 2016
@kylezeeuwen kylezeeuwen changed the title Protractor 3.2.1 directconnect to npm:chromedriver fails on Windows 8 with ENOENT Protractor 3.2.2 directconnect to npm:chromedriver fails on Windows 8 with ENOENT Mar 29, 2016
@kylezeeuwen
Copy link
Author

Hi @cnishina , I've verified that on Windows with protractor 3.2.2 the chromeDriver setting is not necessary so long as you have run webdriver-manager update.

You should close this bug report as Kyle error !

@NickTomlin
Copy link
Contributor

I'll go ahead and close this as it looks like this is resolved. Thanks for reporting back @kylezeeuwen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants