How to resolve 'unknown error: cannot find Chrome binary' once upgrading to chromedriver 2.25 - windows

The upgrade of chromedriver to 2.25, or Chrome to version 54 has caused the following error:
'unknown error: cannot find Chrome binary'. The location of Chrome has not changed, but it seems that the chromedriver is not looking in a different location? I'm running this using a VM (locally is fine with any versioning)
I've tried adding the following to my protractor-config, but this does not have any affect on the error.
capabilities: {
browserName: 'chrome',
chromeOptions:'binary': 'C:/Program Files (x86)/Google/Chrome/Application/Chrome.exe'},
},
Is there anything else I can try? How do I find the path that the chromedriver is currently looking for the binary?
Any help would be greatly appreciated!

You must upgrade to chromedriver. That is the issue.
Chrome Driver for Windows
Hope this helps. :)

Related

Cypress Error after running open command...'error loading V8 startup snapshot file'. I'm not able to run cypress then

The exact error is:
[0328/091115.205:FATAL:v8_initializer.cc(447)] Error loading V8 startup snapshot file
Could you please help to fix and be able to use Cypress?
I tried (steps):
First: C:/inetpub/wwwroot/cypress-example>npm install
Second: C:/inetpub/wwwroot/cypress-example>npx cypress run
(both command using cmd.exe as administrator permission and I was running it in the file of the website example that I criated...C:/inetpub/wwwroot/cyrpress-teste)
exact error bellow:
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
Please refer to the error below for more details.
[0328/091115.205:FATAL:v8_initializer.cc(447)] Error loading V8 startup snapshot file
Platform: win32-x64 (10.0.19044)
Cypress Version: 9.5.2
I got the same error in cypress v9.5.4
Solved this by installing older version.
Just uninstall the current version, write "cypress": "^8.4.1" and run npm i

OSX fix Selenium Chromedriver launch error spawn Unknown system error -86 Bad CPU type in executable?

Suddenly on the afternoon of January 6, 2021, my Selenium Protractor tests under OSX stopped working with the mysterious error
spawn Unknown system error -86
I did some research and discovered that error number 86 is the same as
Bad CPU type in executable
and ran the following to compare the cpu architecture of my chromedriver binary to my system:
% file chromedriver_87.0.4280.88
chromedriver_87.0.4280.88: Mach-O 64-bit executable arm64
% uname -a
Darwin kobl179273m 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
% uname -p
i386
How can I fix the chromedriver binary used by my Selenium so that it will run on my Intel x64 mac and clear the "system error -86" or "Bad CPU type" message?
The issue is described in https://github.com/angular/webdriver-manager/issues/476.
This has been now fixed in 12.1.8 so just update to that webdriver manager.
For most users this can be accomplished with
npm uninstall protractor && npm install protractor
Edit: this answer should be considered deprecated now that the underlying bug in webdriver-manager has been fixed. A better solution would be to upgrade to the newest version of webdriver-manager. The answer below may be useful if people need to use an older version of webdriver-manager which still has the bug.
As per Deepak Srinivasan's comment above, this error is caused by https://github.com/angular/webdriver-manager/issues/476
Root Cause:
The ChromeDriver team added "_m1" to the end of the filename for their Apple Silicon ARM builds of Chromedriver -- but both the Silicon and Intel versions of chromedriver have "mac64" in the filename, and the version number is exactly the same. This causes webdriver-manager to always download the Silicon build of Chromedriver, even on Intel macs. As a general solution, simply avoid using the chromedriver that has _m1 in its filename if you are on an Intel mac.
Solution 1: Downgrade to Chrome 86.0.4240.198 and Chromedriver 86.0.4240.22. These versions work together and are the most recent versions prior to the new and problematic support for Silicon ARM
Chrome 86 download page:
https://google-chrome.en.uptodown.com/mac/download/2920124
Disable auto-updates in Chrome: https://superuser.com/questions/1359017/how-do-i-disable-automatic-updates-of-google-chrome-on-mac-os-x
Chromedriver 86: https://chromedriver.storage.googleapis.com/index.html?path=86.0.4240.22/
% webdriver-manager update --versions.chrome=86.0.4240.22
Solution 2: Modify the webdriver-manager npm package to point to the correct chromedriver (thanks to ciekaway from the angular github issue page for this fix)
Modify the following file
node_modules/webdriver-manager/built/lib/files/file_manager.js
or, if using protractor
node_modules/protractor/node_modules/webdriver-manager/built/lib/files/file_manager.js
Near the top of the downloadFile method around line 166, add the following line to remove "_m1" from the name of the file:
fileUrl.url = fileUrl.url.replace(/_m1/, '');
It needs to be after the beginning of the .then block that starts with
binary.getUrl(binary.version()).then(fileUrl => {
it also needs to be before the next reference to fileUrl.
For example:
binary.getUrl(binary.version()).then(fileUrl => {
binary.versionCustom = fileUrl.version;
fileUrl.url = fileUrl.url.replace(/_m1/, '');
let filePath = path.resolve(outputDir, binary.filename());
Note that this solution is temporary. It will be overwritten by an npm install. The Chromedriver and/or the webdriver-manager team will probably fix this issue, at which point you should clear the modified version of your webdriver-manager and download the fix from npm.
For macOS Catalina Version 10.15.6 (19G73)
In my case I was working with Rails and Capybara for feature tests. What worked for me was
First, find the actual chromedriver location running:
which chromedriver
# Which returned:
/Users/alex/.webdrivers/chromedriver
Then, install chromedriver via Homebrew:
brew install chromedriver
Then, remove old chromedriver reference found at previous location with:
rm /Users/alex/.webdrivers/chromedriver
Now, link the old chromedriver reference to the one installed with brew:
ln -s /usr/local/bin/chromedriver /Users/alex/.webdrivers/chromedriver
Then, open Finder app, then click on Go menu and then click Go to folder ... option, and enter this route:
/usr/local/Caskroom/chromedriver/
There you should see a folder with the chromedriver version you have installed, something like this:
88.0.4324.96
Enter that folder and you should see the chromedriver binary file.
Right click on it, and click on Open
Now, you should get a terminal window popping up with the output:
Last login: Sun Jan 31 12:29:15 on ttys001
/usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
  ~  /usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b- refs/branch-heads/4324#{#1784}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Finally, press Ctrl+C to stop the execution and quit the terminal window.
Now, you should be able to run capybara tests.
npm uninstall protractor && npm install protractor
If you use webdrivers gem, upgrade it:
bundle update webdrivers

VSCode Unable to locate phpcs on macOS

I know this has been asked many times but I can't find an answer that works for me. I'm on a Mac running macOS 10.15.6 and I'm getting the issue of Unable to locate phpcs in VSCode version 1.47.3. The actual error is:
phpcs: Unable to locate phpcs. Command failed: "/Users/mat/.composer/vendor/bin/phpcs" --version
If I run /Users/mat/.composer/vendor/bin/phpcs --version in my terminal I get the correct response and if I do which phpcs I get the desired /Users/mat/.composer/vendor/bin/phpcs.
When I switch the VSCode extension works as it should but then when I close and reopen VSCode I get the error, which is solved again if I switch extensions.
My VSCode settings are:
"phpcs.enable": true,
"php.validate.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.standard": "PSR12",
I've really been unable to figure out why this error keeps happening when I launch VSCode. Any help would be greatly appricated.
Thanks

Error: unknown error: DevToolsActivePort file doesn't exist, when executing ruby script with watir

I am fairly new to Centos7 and trying to develop a solution for browser automation in the below environment:
OS: Centos7
Ruby: 2.6
Watir
Browser:Google Chrome 72.0.3626.109
Driver: ChromeDriver 2.46.628388
My script:
require 'watir'
# Initialize the browser with the driver path
site="https://google.com"
browser = Watir::Browser.new :chrome
browser.goto site
Getting error:
`assert_ok': unknown error: Chrome failed to start: exited abnormally (Selenium::WebDriver::Error::UnknownError)
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 3.10.0-957.5.1.el7.x86_64 x86_64)
I found multiple solutions on net that are recommending to modify chrome options like:
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
But I don't know where to set these. The nearest I was able to reach is the answers provided here: How do I pass options to the Selenium Chrome driver using Python?
Can anyone please help me to resolve it in a step-by-step manner?
Also faced similar issue but with npm and protractor configuration but I guess the solution would be similar. You have to install chrome browser in your linux system.
The chromedriver is just a wrapper written to use the chromebrowser for running the test cases.
Also if google-chrome is installed you might want to check the path were it is installed in linux based operating system the path expected is under /usr/bin/google-chrome. This file is generally a link to the actual binary of the chrome.
Hope so this helps

Unable to obtain stable firefox connection in 60 seconds

I am continuously getting error below error :
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)\n[\"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:90:in `connect_until_stable'\", \"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:55:in block in launch'\", \"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/socket_lock.rb:43:in locked'\", \"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:51:in launch'\", \"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/bridge.rb:43:in initialize'\", \"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:in new'\",
\"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:in for'\",
\"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver.rb:86:in for'\",
\"/usr/local/rvm/gems/ruby-1.9.3-p551/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:46:in initialize'\"...`
I am using:
Firefox version 42.0,
selenium-webdriver version 2.52.0
ruby version 1.9.3-p551
watir-webdriver (0.9.1)
Can anybody please help me?
I have a similar setup to yours and what worked for me was to reinstall an older version for Firefox, for example version 32 (I had Firefox v43 and it was not working, same error message as yours).
You can download older Firefox versions from:
https://ftp.mozilla.org/pub/firefox/releases/
Make sure to turn off auto-update (otherwise it will update automatically to the latest version after you restart it).

Resources