Chrome Selenium WebDriver failing with timeouts - selenium

I have a windows service that periodically runs through a bunch of pages to collect information.
Things are more or less working however a large number of them have been getting timeout errors.
About 70 run at a time on a machine with 24 logical processors and more than enough memory.
I am using Chrome 51.0.2704.84 (64-bit) with ChromeDriver 2.22.397933.
The error is:
2016-06-17 09:26:11.3590|ERROR|11548|117|Unable to execute work request|MessageHandlerException: timeout: cannot determine loading status
from timeout: Timed out receiving message from renderer: -0.006
(Session info: chrome=51.0.2704.84)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.3.9600 x86_64) ---> OpenQA.Selenium.WebDriverTimeoutException: timeout: cannot determine loading status
from timeout: Timed out receiving message from renderer: -0.006
(Session info: chrome=51.0.2704.84)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.3.9600 x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
Any thoughts?

Use setTimePageLoadTimeOut(TimeSpan.Minvalue);
My Config is 2.53 selenium and chrome 51 and windows server 2012
Had issue with timeout(My test site is very slow)
Used this so far its working

Related

WebDriverException: unknown error: Chrome failed to start: exited abnormally error running Selenium Grid on Server using ChromeDriver and Chrome

Good evening,
I tried to run my automated tests on a server with Eclipse / Selenium and TestNG. So far the configuration of Selenium Grid worked fine. I got the response:
23:02:55.068 INFO - Selenium Grid hub is up and running
23:03:30.488 INFO - Registered a node http://81.169.xxx.xxx:5555 <br>
23:05:25.423 INFO - Registering the node to the hub: http://81.169.xxx.xxx:4444/grid/register
23:05:25.432 INFO - The node is registered to the hub and ready to use
Here's my example code:
#Test
public void executeOnServer() throws MalformedURLException {
System.out.println("Test started");
DesiredCapabilities dcp = new DesiredCapabilities();
dcp.setBrowserName("chrome");
dcp.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://81.169.xxx.xxx:5555/wd/hub/"), dcp);
driver.manage().window().maximize();
driver.get("https://google.de");
driver.quit();
}
Unfortunately I got the error:
[RemoteTestNG] detected TestNG version 6.14.3
Test started
FAILED: executeOnServer
org.openqa.selenium.WebDriverException: unknown error: **Chrome failed to start: exited abnormally.**
(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.)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
The path to the chromedriver is:
usr/local/bin/chromedriver
Installed version:
https://chromedriver.storage.googleapis.com/index.html?path=**84.0.4147.30**/chromedriver_linux64.zip
Do you have any idea how I could fix the error? Had a look at different sites with this error, no solution is working for me.
This error message...
Test started
FAILED: executeOnServer
org.openqa.selenium.WebDriverException: unknown error: **Chrome failed to start: exited abnormally.**
(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.)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
...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=84.0
Possibly you are using the latest chrome=84.0
Your Selenium Client version is 3.4.0 of revision: 'unknown', time: 'unknown'
So that implies the ChromeDriver is unable to interact with the Selenium bindings as there is a clear mismatch between Selenium v3.4.0 and the ChromeDriver v84.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v84.0 level.
Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
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.

getting error when executing the selenium testng tests in jenkins job in centos7.6 VM

I am able to execute the tests in windows properly, but when I create the jenkins job in centos7.6 VM and the jenkins job console output shows the below error.
This is what I have defined in the code:
{
System.setProperty("webdriver.chrome.driver", "/tmp/chromedriver_linux");
}
driver = new ChromeDriver();
Below is the error:
enter code here Test01(com.training.multi.browser.testing.MultiTests) Time elapsed: 2.164 sec <<< FAILURE!
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=75.0.3770.140 (2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770#{#1155}),platform=Linux 3.10.0-957.27.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.66 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.27.2.el7.x86_64', java.version: '1.8.0_222'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at com.training.multi.base.BaseTest.getDriver(BaseTest.java:19)
at com.training.multi.browser.testing.MultiTests.Test01(MultiTests.java:36)`
There are a couple of additional steps you need to take in order to make test running in Jenkins on Linux via setting extra ChromeOptions
Make sure to add --headless argument as systems running Jenkins normally don't have GUI
If you're running Jenkins as root user you also need to set --no-sandbox option
Something like:
ChromeOptions options = new ChromeOptions();
options.addArguments(Arrays.asList("--headless", "--no-sandbox"));
options.setBinary("/path/to/chromedriver");
ChromeDriver driver = new ChromeDriver(options);
Also make sure that the user has appropriate permissions in order to launch the chromedriver binary, if not - grant them using chmod command like:
chmod +x /tmp/chromedriver_linux
More information: How to use Jenkins pipeline to launch Selenium tests
(unknown error: DevToolsActivePort file doesn't exist)
This error is caused when there is incompatibility in version of chrome and chromedriver you are using. Upgrade chrome browser on your centos machine and download the new chrome version compatible chromedriver.

Do we need to install Chrome binaries on Selenium grid to avoid getting "WebDriverError: unknown error: cannot find Chrome binary"? [duplicate]

This question already exists:
Getting "WebDriverError: unknown error: cannot find Chrome binary" when pointing Protractor test to selenium grid [duplicate]
Closed 4 years ago.
I have set up a new selenium grid on Linux server executing the following way
The first command --> 'java -jar ./selenium-server-standalone-3.141.59.jar -role hub'
Second --> 'java -Dwebdriver.chrome.driver=./grid/chromedriver -jar ./selenium-server-standalone-3.13.0.jar -role node -hub http://10.0.39.73:4444/grid/register/'
After going through the previous posts, helpers have been suggested to specify the driver path as I did. But still getting the same below error. Do I have to install the Chrome binary in the default location(/usr/bin/google-chrome) even if I want to use selenium grid?
[chrome #01-1] C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\error.js:546
[chrome #01-1] throw new ctor(message);
[chrome #01-1] ^
[chrome #01-1] WebDriverError: unknown error: cannot find Chrome binary
[chrome #01-1] (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.77-70.59.amzn1.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
[chrome #01-1] Command duration or timeout: 4 milliseconds
[chrome #01-1] Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
[chrome #01-1] System info: host: 'ip-10-0-39-73', ip: '10.0.39.73', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.77-70.59.amzn1.x86_64', java.version: '1.8.0_141'
[chrome #01-1] Driver info: driver.version: unknown
[chrome #01-1] at Object.checkLegacyResponse (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\error.js:546:15)
[chrome #01-1] at parseHttpResponse (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\http.js:509:13)
[chrome #01-1] at doSend.then.response (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\http.js:441:30)
[chrome #01-1] at process._tickCallback (internal/process/next_tick.js:68:7)```
i Think server not access the chrome binary from your user directory you can bcz chrome installed on local machine
you can simply instruct Chromedriver where to look for Chrome Binary that might help
ChromeOptions chromeOptions= new ChromeOptions();
chromeOptions.setBinary("C:\\please make sure path is correct till parent filder \\Chrome.exe");
ChromeDriver driver = new ChromeDriver(chromeOptions);

org.openqa.selenium.SessionNotCreatedException because of "Chrome version must be >= 64.0.3282.0" although version is 65.0.3325.181 on Travis CI

While I was attempting to extend Arquillian PrimeFaces's .travis.yml with a setup for phantomjs and chromeheadless browser driver for functional tests with Selenium, I experienced
java.lang.RuntimeException: Could not create statement
Caused by: java.lang.RuntimeException:
Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(Capabilities): org.openqa.selenium.SessionNotCreatedException: session not created exception: Chrome version must be >= 64.0.3282.0
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.SessionNotCreatedException:
session not created exception: Chrome version must be >= 64.0.3282.0
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
So, I updated chromium-browser with sudo add-apt-repository --yes ppa:saiarcot895/chromium-dev && sudo apt-get update && sudo apt-get install --yes chromium-browser and verified that it's the only Chrome binary and has a matching version with which -a chromium-browser && chromium-browser --version which reveals that the only binary is /usr/bin/chrominum-browser and has version 65.0.3325.181. However, the error persists.
I researched and found issues with Chrome on Travis CI like
https://github.com/travis-ci/travis-ci/issues/938 which is about permissions (as opposed to versions)
Chromedriver on Travis-CI which summarizes issues
and checked the Arquillian web driver configuration options for Chrome which don't seem to include one to expose the actual pick up of the ghost 64.x binary.
An example run of the failure can be found at https://travis-ci.org/krichter722/arquillian-primefaces/jobs/364342730.
In your question you have mentioned about using Chrome v65.0.3325.181 but the error stack strace shows different versions as follows :
Caused by: org.openqa.selenium.SessionNotCreatedException:
session not created exception: Chrome version must be >= 64.0.3282.0
This essentially means ChromeDriver is unable to detect the right version of chrome binary. It appears you either have installed multiple instances of Chrome Browsers and have multiple instances of chrome binaries within your system or there are multiple stray instances of chrome binaries available within your system.
Solution
You must ensure that Chrome is installed at the optimum location as the server expects you to have Chrome installed in the default location for each system as per the snapshot below :
Note : For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following the documentation Using a Chrome executable in a non-standard location.
Clean your Project Workspace through your IDE 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 Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.

PhantomJS or Selenium Standalone killed after first failed tests

I don't know if this is a Protractor or PhantomJS error.
I'm running this command, getting this log.
It seems like PhanthomJS or Selenium Standalone is dying after the fist fail test.
Do you need more logs/details to check where is the issue?
$ grunt accept:standalone --suite=list
Running "env:rde" (env) task
Running "shell:protractor_update" (shell) task
selenium standalone is up to date.
chromedriver is up to date.
Running "protractor_webdriver:start" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.0.0.1:4444
Running "protractor:test" (protractor) task
Using the selenium server at https://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: loggingPrefs=org.openqa.selenium.logging.LoggingPreferences#255d17d7, count=1, browserName=phantomjs, phantomjs.binary.path=c:\git\clients\special-offers\node_modules\phantomjs\lib\phantom\phantomjs.exe, version=ANY
Preparing new session
.FF
Failures:
1) Special Offers list page should have a thumbnail, a title, a description and a CTA
Message:
NoSuchElementError: No element found using locator: By.cssSelector(".ss .details p.body-copy")
2) sssssssssssssss
Message:
UnknownError: Error communicating with the remote browser. It may have died.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'CBA-D013', ip: 'xxxxxx', os.name: 'Windows NT (unknown)', os.arch: 'amd64', os.version: '6.2', java.version: '1.6.0_26'
Driver info: driver.version: EventFiringWebDriver
Finished in 29.282 seconds
3 tests, 6 assertions, 2 failures
Session deleted: Keeping the Selenium server alive
c:\git\clients\special-offers\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
^
>>
>> Test failed but keep the grunt process alive.
Running "shell:kill_selenium" (shell) task
Shutting down Selenium server: http://127.0.0.1:4444
Done, without errors.
Bye all!