ChromeDriver Session Timeouts in version 93 - selenium-webdriver

Chrome 93 was released recently. Roughly around this time (Aug 31 at 4PM Central) our end-to-end tests started failing. These tests leverage Protractor, they are running via TeamCity, on a Windows build agent that has Chrome 93 installed.
We have tried to force a 93.x and a 92.x version of chromedriver. Both produce this timeout below. We can run these e2e tests locally without issue. Any suggestions?
[10:23:38] I/launcher - Running 1 instances of WebDriver
10:23:38 [10:23:38] I/direct - Using ChromeDriver directly...
10:33:40 [10:33:40] E/launcher - session not created
10:33:40 from timeout: Timed out receiving message from renderer: 600.000
10:33:40 (Session info: chrome=93.0.4577.63)
10:33:40 (Driver info: chromedriver=93.0.4577.15 (660fc11082ba57405eca2e8c49c3e1af756fbfae-refs/branch-heads/4577#{#203}),platform=Windows NT 10.0.14393 x86_64)
10:33:40 [10:33:40] E/launcher - SessionNotCreatedError: session not created
10:33:40 from timeout: Timed out receiving message from renderer: 600.000
10:33:40 (Session info: chrome=93.0.4577.63)
10:33:40 (Driver info: chromedriver=93.0.4577.15 (660fc11082ba57405eca2e8c49c3e1af756fbfae-refs/branch-heads/4577#{#203}),platform=Windows NT 10.0.14393 x86_64)
10:33:40 at Object.checkLegacyResponse (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\selenium-webdriver\lib\error.js:546:15)
10:33:40 at parseHttpResponse (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\selenium-webdriver\lib\http.js:509:13)
10:33:40 at C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\selenium-webdriver\lib\http.js:441:30
10:33:40 at processTicksAndRejections (internal/process/task_queues.js:93:5)
10:33:40 From: Task: WebDriver.createSession()
10:33:40 at Function.createSession (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
10:33:40 at Function.createSession (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\selenium-webdriver\chrome.js:761:15)
10:33:40 at Direct.getNewDriver (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\built\driverProviders\direct.js:77:33)
10:33:40 at Runner.createBrowser (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\built\runner.js:195:43)
10:33:40 at C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\built\runner.js:339:29
10:33:40 at _fulfilled (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\node_modules\q\q.js:834:54)
10:33:40 at C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\node_modules\q\q.js:863:30
10:33:40 at Promise.promise.promiseDispatch (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\node_modules\q\q.js:796:13)
10:33:40 at C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\node_modules\q\q.js:556:49
10:33:40 at runSingle (C:\BuildAgent\work\f3ee5d88fcfb5472\node_modules\protractor\node_modules\q\q.js:137:13)
10:33:40 [10:33:40] E/launcher - Process exited with error code 199

It's not an identical question/situation, but there is a bunch of helpful insight in this SO post.
We're using protractor, so for us the fix was adding the --disable-gpu argument below, which was also hinted at a bunch in the above SO post.
chromeOptions: {
args: [
'--disable-gpu'
]
}
Not sure why this was needed as-of Chrome 93 for us, but it is also listed in the Protractor browser setup (claiming this is needed as of Chrome 58).
As of Chrome 58 you also need to set --disable-gpu, though this may
change in future versions.

I was able to fix the problem try using the following options (not nice, but it works...):
chromeOptions.addArguments("no-sandbox");
chromeOptions.addArguments("disable-infobars");
chromeOptions.addArguments("disable-dev-shm-usage");
chromeOptions.addArguments("disable-browser-side-navigation");
chromeOptions.addArguments("disable-gpu");
chromeOptions.addArguments("--dns-prefetch-disable");
chromeOptions.addArguments("disable-extensions");
chromeOptions.addArguments("force-device-scale-factor=1");
chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL);
chromeOptions.addArguments("enable-features=NetworkServiceInProcess");
chromeOptions.addArguments("--aggressive-cache-discard");
chromeOptions.addArguments("--disable-cache");
chromeOptions.addArguments("--disable-application-cache");
chromeOptions.addArguments("--disable-offline-load-stale-cache");
chromeOptions.addArguments("start-maximized");
chromeOptions.addArguments("lang=de");
chromeOptions.addArguments("allow-running-insecure-content");
chromeOptions.addArguments("inprivate");

Related

NoSuchWindowError: Browsing context has been discarded with GeckoDriver Firefox and Protractor(Selenium)

I'm trying to run a simple test script using protractor.
Environment:
Node Version: v9.8.0
Protractor Version: 5.4.1
Angular Version: 1.x
Browser(s): Mozilla Firefox 60.1.0
Operating System and Version: HELiOS release 6.10
Here's my protractor config file.
exports.config = {
specs: ['todo-spec.js'],
capabilities: {
browserName: 'firefox',
marionette : true
}
};
This is my test script (todo-spec.js)
describe('application homepage', function() {
it('should open homepage', function() {
console.log("Opening localhost app");
browser.get('http://localhost:8080/app/');
browser.sleep(20000); // just to check if application loaded or not
});
});
This is my node_modules/protractor/node_modules/webdriver-manager/selenium/ directory looks like:
When I run my test using /path/to/protractor conf.js, I'm getting below mentioned error.
[16:51:03] I/launcher - Running 1 instances of WebDriver
[16:51:03] I/local - Starting selenium standalone server...
[16:51:04] I/local - Selenium standalone server started at http://<ip-address>:45089/wd/hub
Started
Opening localhost
F
Failures:
1) application homepage should open homepage
Message:
Failed: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
Stack:
NoSuchWindowError: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Protractor.get(http://localhost:8080/app/) - reset url
at thenableWebDriverProxy.schedule (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at ProtractorBrowser.executeScriptWithDescription (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:404:28)
at driver.controlFlow.execute.then.then.then (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:679:25)
at ManagedPromise.invokeCallback_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:2927:27)
at /export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:668:7
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Run it("should open homepage") in control flow
at UserContext.<anonymous> (/export/home/test/protractor_test_2/node_modules/jasminewd2/index.js:94:19)
From asynchronous test:
Error
at Suite.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:2:3)
at Object.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:1:63)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
1 spec, 1 failure
Finished in 0.159 seconds
[16:51:06] I/local - Shutting down selenium standalone server.
[16:51:06] I/launcher - 0 instance(s) of WebDriver still running
[16:51:06] I/launcher - firefox #01 failed 1 test(s)
[16:51:06] I/launcher - overall: 1 failed spec(s)
[16:51:06] E/launcher - Process exited with error code 1
Any help would be appreciated.
This error message...
Failed: Browsing context has been discarded
...implies that the communication between GeckoDriver and Marionette was broken.
Some more information regarding the GeckoDriver binary version would have given us some clues about whats wrong happening. However this issue can happen due to multiple factors as follows:
As per Hang when navigation request removes the current browsing context if you have used driver.navigate().back(); when Selenium's focus was within an <iframe> this error is observed.
As per Crash during command execution results in "Internal Server Error: Failed to decode response from marionette" this issue can also occur due to ctypes checks for NULL pointer derefs.
You can find the Selenium testcase here. Perhaps instead of panicking, it would have been better to handle this more gracefully by clearing any state and returning geckodriver to accept new connections again.
As per Failed to decode response from marionette - Error to open Webdriver using python this issue can also occur if you are not using the complient version of the binaries.
This usecase
The root cause of this issue seems to be MemoryUsage. As per Intermittent awsy\test_memory_usage.py TestMemoryUsage.test_open_tabs | NoSuchWindowException: Browsing context has been discarded which is intermittent in nature. This issue was once marked as RESOLVED then again REOPENED.
As #Madhan mentioned while working with AngularJS applications and Protractor always include:
waitForAngularEnabled(true);
Finally, as per best practices while working with GeckoDriver, Selenium and Firefox Browser follow the below compatibility chart:
Supported platforms
Was able to fix this issue with below configuration.
- Protractor: v5.4.1
- Selenium JAR driver: selenium-server-standalone-3.141.59.jar
- geckodriver:geckodriver-v0.20.0-linux64
Also we need to give path of geckodrvier in protractor conf file.
geckoDriver: 'node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.0'
By default webdriver-manager will download latest version of geckodriver which is 0.24.0. But the needed geckdriver is v0.20.0, so I downloaded this manually and placed it inside node_modules/protractor/node_modules/webdriver-manager/selenium/ directory.
Hope this helps to people facing similar issue.

Protractor: how to catch webdriver initialization errors

I would like to catch/handle this Error:
07:28:34 > protractor protractor.config.js
07:28:34 [07:28:34] I/launcher - Running 1 instances of WebDriver
07:28:34 [07:28:34] I/direct - Using ChromeDriver directly...
07:28:35 [07:28:34] E/launcher - unknown error: Chrome failed to start: exited abnormally
07:28:35 (unknown error: DevToolsActivePort file doesn't exist)
07:28:35 (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
07:28:35 (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 3.10.0-862.14.4.el7.x86_64 x86_64)
07:28:35 [07:28:34] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
07:28:35 (unknown error: DevToolsActivePort file doesn't exist)
07:28:35 (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
07:28:35 (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 3.10.0-862.14.4.el7.x86_64 x86_64)
07:28:35 at Object.checkLegacyResponse (/opt/jenkins/workspace/monitoring-app/node_modules/selenium-webdriver/lib/error.js:546:15)
07:28:35 at parseHttpResponse (/opt/jenkins/workspace/monitoring-app/node_modules/selenium-webdriver/lib/http.js:509:13)
07:28:35 at doSend.then.response (/opt/jenkins/workspace/monitoring-app/node_modules/selenium-webdriver/lib/http.js:441:30)
07:28:35 at process._tickCallback (internal/process/next_tick.js:68:7)
07:28:35 From: Task: WebDriver.createSession()
07:28:35 at Function.createSession
[...]
07:28:35 [07:28:34] E/launcher - Process exited with error code 199
07:28:35 npm ERR! Test failed. See above for more details.
Where can I do that? In the protractor.config.js?

protractor - session not created exception

I am getting the error below when trying to run Protractor test against chrome.
session not created exception: Chrome version must be >= 59.0.3071.0
[11:42:23] E/launcher - session not created exception: Chrome version must be >= 59.0.3071.0 (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide
any stacktrace information) Command duration or timeout: 6.44 seconds Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z' System info: host: 'PC328569', ip: '10.25.227.179', os.name: 'Windows 7', os.arch: 'amd64', os.version:
'6.1', java.version: '1.8.0_121' Driver info: driver.version: unknown [11:42:23] E/launcher - SessionNotCreatedError: session not created exception: Chrome version must be >= 59.0.3071.0 (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows
NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 6.44 seconds Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z' System info: host: 'PC328569', ip:
'10.25.227.179', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121' Driver info: driver.version: unknown at WebDriverError (D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\error.js:27:5) at SessionNotCreatedError
(D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\error.js:214:5) at Object.checkLegacyResponse (D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\error.js:505:15) at parseHttpResponse (D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\http.js:440:13) at process._tickCallback (internal/process/next_tick.js:103:7) From: Task: WebDriver.createSession() at Function.createSession (D:\Balachander\DailyScript\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
at Function.createSession (D:\Balachander\DailyScript\node_modules\selenium-webdriver\chrome.js:709:29) at createDriver (D:\Balachander\DailyScript\node_modules\selenium-webdriver\index.js:167:33) at Builder.build (D:\Balachander\DailyScript\node_modules\selenium-webdriver\index.js:623:16)
at Hosted.getNewDriver (D:\Balachander\DailyScript\node_modules\protractor\lib\driverProviders\driverProvider.ts:60:29) at Runner.createBrowser (D:\Balachander\DailyScript\node_modules\protractor\lib\runner.ts:225:39) at q.then.then (D:\Balachander\DailyScript\node_modules\protractor\lib\runner.ts:391:27)
at _fulfilled (D:\Balachander\DailyScript\node_modules\q\q.js:834:54) at self.promiseDispatch.done (D:\Balachander\DailyScript\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (D:\Balachander\DailyScript\node_modules\q\q.js:796:13) [11:42:23]
E/launcher - Process exited with error code 199
Versions of the executables used:
webdriver manager - 12.0.6
protractor - 5.1.2
chrome driver - 2.32
Java - 1.8
What I have tried:
1.Updating the webdriver to latest version
npm update -g protractor
webdriver-manager update
2.Editing Protractor's config file: node_modules/protractor/config.json
Changing the chrome driver version to whatever you need. eg. "chromedriver": "2.24".Run webdriver-manager update.
But for some reason webdriver-manager always uses chrome driver 2.32.
Any help or suggestion is appreciated. Thanks.
As per Below references you need to update your actual installed chrome.
Update chrome by :- About Google Chrome
Menu -> Help ->
Refer :-
https://github.com/appveyor/ci/issues/1600
Chromedriver error "Chrome version must be >= 52" using Nightwatch
Hope it will help you :)

Getting "Error: read ECONNRESET" on reseting and launching the app

I am getting the following error on resetting the app [driver.resetApp()] and on launching the app on Appium (version: 1.4.16.1). I am using Java.
Eclispe console
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: chrome=50.0.2661.86)
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.08 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'IN2084073W1', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
*** Element info: {Using=id, value=password}
Session ID: 2968b7e9-948e-4b75-94ed-838d10a08c82
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{platform=LINUX, app=C:/apk/appname.apk, javascriptEnabled=true, appActivity=.MainActivity, browserName=, networkConnectionEnabled=true, desired={newCommandTimeout=120, app=C:/apk/surveyorapp.apk, platformVersion=5.1, deviceName=TA93303Q2F, platformName=Android, appActivity=.MainActivity, browserName=, appPackage=com.axa.surveyorapp}, locationContextEnabled=false, appPackage=com.axa.surveyorapp, newCommandTimeout=120, platformVersion=5.1, databaseEnabled=false, deviceName=TA93303Q2F, platformName=Android, webStorageEnabled=false, warnings={}, takesScreenshot=true}]
Appium Log
error: Could not proxy command to remote server. Original error: Error: read ECONNRESET
error: Chromedriver: Chromedriver exited unexpectedly with code 3221225477, signal null
info: Chromedriver: Changed state to 'stopped'
warn: Chromedriver for context WEBVIEW_com.clientname.appname stopped unexpectedly
error: Chromedriver quit unexpectedly during session
Update
Thanks for the update Emna. I have tried your option.
Can you please let me know how exactly I need to add this. I am using AndroidDriver not AppiumDriver. I have tried with both, but I'm getting below error.
Try to use :
(AppiumDriver)driver.resetApp();
Instead of :
driver.resetApp();
You can have a look into this link: Appium java-client
and use this link also to download ;)

Protractor - Safari - Timed out awaiting response to command "sendKeysToElement"

One of my E2E Test is failing only on Safari browser, when trying to send Text to an inputBox.
element(by.css('#content')).clear();
element(by.css('#content')).sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
Seeing following error in Webdriver manager console
18:40:12.150 INFO - Executing: [send keys: 16 [[SafariDriver: safari
on MAC (null)] -> css selector: #contentText],
[Falsches%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20lluvia%20y%20%0A%200c%F4t%E9%20de%20l%27alc%F4ve%20ovo%EFde%2C%20o%F9%20les%20b%FBche%u0E40%u18:40:42.663
WARN - Exception thrown org.openqa.selenium.TimeoutException: Timed
out awaiting response to command "sendKeysToElement" after 30004 ms
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.02 seconds Build info: version:
'2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System
info: host: 'vq-mac-dt-036.local', ip: '10.21.134.62', os.name: 'Mac
OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version:
'1.8.0_31' Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true,
javascriptEnabled=true, version=7.0.6, cssSelectorsEnabled=true,
platform=MAC, secureSsl=true}] Session ID: null at
sun.reflect.GeneratedConstructorAccessor57.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowa18:40:42.664
WARN - Exception: Timed out awaiting response to command
"sendKeysToElement" after 30004 ms (WARNING: The server did not
provide any stacktrace information) Command duration or timeout: 30.02
seconds
This test is working in Firefox, Chrome Browsers. I can't find any open issue related to safari driver.
Could you please advise, how to resolve this.
Thanks in advance.
Try chaining the clear, click and sendKeys functions on the input box to send the value. I don't think the UTF8 text should cause any problem. Here's how to do it -
var ele = element(by.css('#content'));
ele.clear().then(function(){
ele.click().then(function(){
ele.sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
});
});
Hope this helps.

Resources