Selenium - Uncaught WebDriverError: chrome not reachable - google-chrome

Currently I'm using the follow stack:
1. Selenium Webdriver 3.0.1 (NodeJS API)
2. Mocha
3. Chromedriver 2.25.3
Often when I run my tests in Codeship (continuous integration) I get this error:
Uncaught WebDriverError: chrome not reachable
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.2.0-42-generic x86_64)
Note: This never happened running locally, only occurs when my tests start in codeship, and it's an intermittent error (sometimes it happens, sometimes not)
Screenshot error:
Any ideia how solve this?

Does codeship have chrome installed on their test server?
I'm guessing not. It might be better to run this against phantomjs (headless browser) instead for CI purposes.

Related

finding Element causing chrome driver instance to crash

First the Environment:
Node JS 16.15.0
Web Driver io v7 (wdio)
wdio/cucumber framework
end to end testing of a website
-obviously using cucumber and feature files
using a test configuration file similar to wdio's
using wdio-chromedriver-service v7.2.6 and npm chromedriver package version ^107 to produce a browser to hit
my browser : chrome v107.0.5304.62
The Question:
an element cannot be found by webDriver as I expect, but the command causes the instance to crash
I am searching for an element that no longer appears on the page (it is a spinner element that shows the page is loading)
I call
if(await this.spinner.isDisplayed())
and then the test run hangs, the debugger tells me the command
INFO webdriver: COMMAND findElement("css selector", "i.fa-spinner")
is running and then nothing else, finally the renderer times out
WARN chromedriver: [SEVERE]: Timed out receiving message from renderer: 600.000
DEBUG webdriver: request failed due to response error: timeout
and the chrome instance crashes shortly later
I am unsure why this behavior is happening, is something wrong with my wdio configuration? or with my chrome driver?
What I have tried
I understand that
browser.setTimeout exists but
I am sure it is not set in my config anywhere.
I have done a global search (using vscode for all development) for browser.setTimeout (no results).
I have manually set browser.setTimeout({ 'implicit': 0 }) (no success).
I have also tried directly hitting a chrome driver instance by manually downloading a chrome driver exe that matched my browser version v107.0.5304.62 and removing the 'services: ['chromedriver']'
from my test config file
when this happens something very interesting occurs, I can keep running after searching for the element that broke the run before, but we dont get very far and the command still causes issues. Chrome driver is throwing errors like
error: 'no such element',
[0-0] message: 'no such element: Unable to locate element: {"method":"css selector","selector":"i.fa-spinner"}\n' +
[0-0] ' (Session info: chrome=107.0.5304.87)'
The browser closes shortly afterwards without progressing through the rest of the tests.
I find it interesting that the version that chrome driver says it is running is 107.0.5304.87 since the version of chromedriver I downloaded clearly says it is v107.0.5304.62 and my chrome version clearly states it is also v107.0.5304.62 .
though theoretically using v107.0.5304.87 shouldnt be an issue according to this
since the 107.0.5304 part matches across the board
I could use some assistance.
We had the same issue this days, seems there is a bug introduced in Chrome 106; try to change config or downgrade Chrome on the machine to use Chrome 105 as with this version is working.

WebdriverIO - Test fails with error Openfin

I have been trying to setup automation testing for our openfin application using the below repo as base
https://github.com/openfin/webinar-automated-integration-tests
I am using Openfin (Chrome version 61.0.3163.100) and Chromedriver 2.40.565498
When I run "npm test", the openfin application opens up. But the tests don't run. After waiting for sometime, it throws the below error in console.
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
chrome
I tried using other versions of chromedriver like 2.33, 2.34, 2.37, 2.38, 2.39, 2.41. Using these versions even the application doesn't appear. So, I guess the chromedriver version I am using is correct. I have also tried adding the below arguments to chromeOptions
--remote-debugging-port=9222,--no-sandbox,--headless,--disable-gpu
They didn't solve my issue. Not sure what is causing the issue. Any help would be much appreciated. Thanks in advance. Cheers!
This error message...
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.40
Release Notes of chromedriver=2.40 clearly mentions the following :
Supports Chrome v66-68
Presumably you are using chrome=61.0
Release Notes of ChromeDriver v2.33 clearly mentions the following :
Supports Chrome 60-62
Your Selenium Client version is unknown to us.
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v60.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v80.0 level.
Chrome is updated to current Chrome Version 80.0 level. (as per ChromeDriver v80.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Selenium WebDriverException: unknown error: call function result missing 'value' while calling sendkeys method

When trying to call Sendkeys method in selenium webdriver it is displaying below error:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7600 x86_64) (WARNING: The server did not provide any stacktrace information)
Selenium Jarversion: 3.10.0
The error says it all :
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7600 x86_64)
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.27
Release Notes of chromedriver=2.27 clearly mentions the following :
Supports Chrome v54-56
You are using chrome=65.0
Release Notes of ChromeDriver v2.36 clearly mentions the following :
Supports Chrome v65-66
Your Selenium Client version is 3.10.0.
Your JDK version is unknown to us.
So there is a clear mismatch between the ChromeDriver version (v2.27) and the Chrome Browser version (v65.0)
Solution
Upgrade ChromeDriver to ChromeDriver v2.36 level.
Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.36 release notes)
Clean your Project Workspace and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
Execute your #Test.
An older version of the ChromeDriver is being spun off when the test is being run; to remedy:
Ensure that you've gotten your browser up to date (v65-67) and get the latest version of the ChromeDriver executable(v2.38)
Extract the ChromeDriver and explicitly set the System property when initializing the ChromeDriver object...
Ex:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver.exe");
WebDriver driver = new ChromeDriver();
I had encountered the same issue. The issue got resolved by updating the chromedriverexe. please check the compatibility of your chrome browser with chrome driver here To download chromedriver

"Cannot get automation extension" error on headless chrome with Selenium (Ubuntu)

I've installed latest Google Chrome 57.0.2987.110, on my Ubuntu server (16.04).
I'm using canopy (which is F# wrapper for Selenium).
I put latest chromedriver in the same folder as my binary, version: 2.28.455506 (and I set the correct path to driver).
I'm starting chrome with --headless argument, like this:
let chromeOpts = ChromeOptions ()
chromeOpts.AddArgument "--headless"
chromeOpts.AddArgument "--disable-gpu"
chromeOpts.AddArgument "start-maximized"
start <| ChromeWithOptions chromeOpts
As soon as it's starts I get this error:
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: content shell=)
(Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.4.0-64-generic x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError (OpenQA.Selenium.Remote.Response errorResponse) [0x000d5] in <2096f357ed27440a8e98c8a8dd645cdd>:0
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute (System.String driverCommandToExecute, System.Collections.Generic.Dictionary`2[TKey,TValue] parameters) [0x00046] in <2096f357ed27440a8e98c8a8dd645cdd>:0
at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute (System.String driverCommandToExecute, System.Collections.Generic.Dictionary 2[TKey,TValue] parameters) [0x00000] in <2096f357ed27440a8e98c8a8dd645cdd>:0
at OpenQA.Selenium.Remote.RemoteWindow.set_Size (System.Drawing.Size value) [0x00067] in <2096f357ed27440a8e98c8a8dd645cdd>:0
at canopy.core.pin (canopy.types+direction direction) [0x0002f] in <58c4b5b9d8107025a7450383b9b5c458>:0
at canopy.core.start (canopy.types+BrowserStartMode b) [0x0050c] in <58c4b5b9d8107025a7450383b9b5c458>:0
It's seems that it fails to set window size.
Is it proper way to launch headless Chrome? I read somewhere that newest version has headless feature.
As I'm using newest version of both Google Chrome and chromedriver I think it shouldn't be a version mismatch.
Also it's working fine on ma local Windows 10 machine with same version of chromedrive (just for windows).
Running with command (and without headless argument):
DISPLAY=:1 xvfb-run mono myapp.exe
Seems to work. I think this resolves my issue.
I leave it here for others looking for a way tu run headless chrome and having same problem.
This solution comes from: http://coderscoffeehouse.com/tech/2017/01/17/headless-front-end-testing-on-linux-using-fsharp.html
There's an open Chromium issue on this topic. It states:
Headless mode doesn't currently support extensions, and it's not clear
whether we can support them easily -- although we are doing some
initial feasibility analysis.
As suggested by #mateuszlewko, the X Virtual Framebuffer (XVFB) can be used as a Linux workaround.

Error using ChromeDriver when kicked off from teamcity

I was having trouble with firefox for my watir-webdriver tests and decided to move over to CHROME. This runs fine local dev box, however when kicked off from team city on our qa server I get the following error:
This is using the same chromedriver as on dev box.
Windows 2003 Server 32 bit
Chrome 14.0.835.186
chromedriver_win32_14.0.836.0.zip ChromeDriver server for win32
Ruby 1.8.7
watir-webdriver 0.3.4
selenium-webdriver 2.7.0
watir-page-helper 0.3.0
Error
[15:57:06]: Started ChromeDriver
[15:57:06]: port=1203
[15:57:31]: .\test\automation\proxy_launcher.cc(89): error: Value of: app_launched
[15:57:31]: Actual: 1
[15:57:31]: Expected: AUTOMATION_SUCCESS
[15:57:31]: Which is: 0
[15:57:31]: Error while awaiting automation ping from browser process
[15:57:56]: .\test\automation\proxy_launcher.cc(223): error: Value of: automation()->GetBrowserWindowCount(&window_count)
[15:57:56]: Actual: false
[15:57:56]: Expected: true
I believe your problem is you're running the TeamCity agent as a service, try manually running the agent using the instructions on: http://confluence.jetbrains.net/display/TCD5/Setting+up+and+Running+Additional+Build+Agents#SettingupandRunningAdditionalBuildAgents-StartingtheBuildAgent
I'm not using TeamCity or Watir, but I had the same error message from webdriver (using selenium server) running under a windows service.
The solution that worked for me was to run the service under another account and not the system account. Might be worth a try?