0

I have a problem with running protractor scripts defined in package.json on Windows 10 machine - locally and on virtual machine.

I have package.json and protractor.conf.js with standard content.

Protractor script in package.json looks as follows:

"run-tests": "protractor protractor.conf.js --baseUrl=https://some-website --capabilities.chromeOptions.binary='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'",

However, when I run it with npm run run-tests I receive error:

Error: more than one config file specified

Removing --capabilities.chromeOptions.binary param fixes the issue, but I do need it on my virtual machine.

Similarly, when I execute the full command directly in terminal tests are run without a hitch, i.e.: protractor protractor.conf.js --baseUrl=https://some-website --capabilities.chromeOptions.binary='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'

I noticed that when I use npm run backslash characters in the path displayed in terminal are already escaped: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

However, even quadrupling backslashes i.e. writing: 'C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe' does not help with the problem.

Do you have any ideas? Or do you perhaps know alternative method to pass the said value to binary param in protractor.conf.js?

Edit: running terminal in administrator mode does not help either.

Maciek
  • 1
  • 1

1 Answers1

0

Ok, I found the solution here:

Protractor option does not work in package.json script

Basically you have to use escaped double quotes enveloping path to file. So it goes like this:

"{some other stuff} --capabilities.chromeOptions.binary=\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\""

Maciek
  • 1
  • 1