Jenkins+Docker+Grid Execution - UnreachableBrowserException: Could not start a new session - selenium-webdriver

While executing my suite dynamically on grid using Docker-compose through Jenkins, I am getting the following exception stacktrace:
org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '49d4c6ec544d', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.25-linuxkit', java.version: '1.8.0_292'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at WebdriverBase.GridDriverManager.setDriver(GridDriverManager.java:144)
at WebdriverBase.GridDriverManager.getDriver(GridDriverManager.java:115)
at stepdefinition.PurchaseWorkflow.init(PurchaseWorkflow.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
My docker-compose.yml file:
My Hub URL : "http://selenium-hub:4444/wd/hub"
When executing the same code on local system everything is working fine on Docker container. Problem arises only when I trigger my test from Jenkins.

This is an old thread but hoping to help anyone out here, not an exact answer as I am just using the standalone browser of selenium but I have the
http://service-name:4444/wd/hub
working in my file.
await new Builder()
.setChromeOptions(options)
.forBrowser("chrome")
.usingServer("http://selenium:4444/wd/hub/")
.build();
Make sure in your docker-compose.yaml file to also use a link in the other service. for example
services:
web:
build:
context: ./web
links:
- selenium
ports:
- "443:443"

Try witch shm_size: 2gb in volumes

Related

Intermittent error in webdriver start up - using WebDriverManager

System.InvalidOperationException : Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: Process unexpectedly closed with status 0
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'a9efa94d3168', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1052-aws', java.version: '11.0.13'
Driver info: driver.version: unknown
I have seen other articles referencing this error and they state that the Chrome driver version and the browser version must be the same. I am using WebDriverManager, which is supposed to ensure that they are the same.
I am running the code in a Gitlab pipeline - it is running in a docker container on Linux.
I only get this error occasionally. If it was a problem with my code set up I would expect to get it on every run.

Selenium server times out waiting for chromedriver - but everything's started

i've tried version 75, 74 and 73 of both chrome and driver. i've tried adding all the selenium jars that come with the server and language bindings to soapuis /bin/ext directory, and then removed them. I've set the server.jar file to chown 7777 (yeah i know i know!). I've installed Xvfb, even Xorg desktop... I've also tried different version of java, all java version 8
sh /home/venerable/SmartBear/SoapUI-5.5.0/bin/testrunner.sh -c 'tester2' -s 'Regression' "/home/venerable/projects/opengoogle" -t "/home/venerable/soapui-settings.xml" -f "/home/venerable/logs" -r -I
code it calls is
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.WebDriver
System.setProperty("webdriver.chrome.driver","/home/venerable/driver/chromedriver")
System.setProperty("webdriver.chrome.logfile","/home/venerable/driver/chromedriver.log")
log.info '############ creating proxy info ##########'
import org.openqa.selenium.Proxy
Proxy proxy = new Proxy()
proxy.setAutodetect(false)
proxy.httpProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.sslProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.socksUsername = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adUser" )
proxy.socksPassword = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adPass" )
log.info 'from system: User is '+proxy.socksUsername
log.info 'from system: '+ System.getProperty("webdriver.chrome.driver")
log.info proxy
ChromeOptions chromeOptions = new ChromeOptions()
chromeOptions.proxy = proxy
chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService")
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.setBinary("/usr/bin/google-chrome-stable")
log.info '################# starting driver #################'
WebDriver driver = new ChromeDriver(chromeOptions)
log.info '================ driver started ================'
driver.get("http://www.google.com")
log.info ":):):):):):):):):)closing driver:(:(:(:(:(:(:(:(:(:("
driver.close()
driver.quit()
return
stack trace i get
================================
=
= SOAPUI_HOME = /home/venerable/SmartBear/SoapUI-5.5.0
= JAVA = /home/venerable/SmartBear/SoapUI-5.5.0/jre/bin/java
=
================================
2019-06-10 18:35:29,621 [main] WARN com.eviware.soapui.SoapUI - Could not find jfxrt.jar. Internal browser will be disabled.
SoapUI 5.5.0 TestCase Runner
####stack was too long so its been ommitted, this is where it counts tho
18:35:33,693 INFO [PluginManager] 5 plugins loaded in 2346 ms
18:35:33,693 INFO [DefaultSoapUICore] All plugins loaded
18:35:34,851 INFO [WsdlProject] Loaded project from [file:/home/venerable/projects/opengoogle]
18:35:34,861 INFO [SoapUITestCaseRunner] Running SoapUI tests in project [tester]
18:35:34,861 INFO [SoapUITestCaseRunner] Running TestCase [tester2]
18:35:34,866 INFO [SoapUITestCaseRunner] Running SoapUI testcase [tester2]
18:35:34,866 INFO [SoapUITestCaseRunner] running step [Groovy Script]
18:35:35,184 INFO [log] from system: /home/venerable/driver/chromedriver
18:35:35,202 INFO [log] ################# starting driver #################
Starting ChromeDriver 75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770#{#40}) on port 14279
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
18:35:55,406 ERROR [SoapUI] An error occurred [Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.2.el7.x86_64', java.version: '1.8.0_212'
Driver info: driver.version: ChromeDriver], see error log for details
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.2.el7.x86_64', java.version: '1.8.0_212'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
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.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at Script1.run(Script1.groovy:16)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:90)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:128)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:76)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:594)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:573)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:405)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:202)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:137)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:112)
at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:122)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:14279/status] to be available after 20002 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
... 33 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 34 more
18:35:55,416 ERROR [SoapUITestCaseRunner] Groovy Script failed, exporting to [/home/venerable/logs/Regression-tester2-Groovy_Script-0-FAILED.txt]
18:35:55,426 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [tester2], time taken: 20542ms, status: FAILED
18:35:55,427 INFO [SoapUITestCaseRunner] TestCase [tester2] finished with status [FAILED] in 20542ms
I've followed these instructions, i see all the bits run individually. The thing is this code works on my windows machine no hassle
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: 'unknown', revision: 'unknown'
and
Selenium Chrome Browser org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start
could this be a known issue? https://github.com/SeleniumHQ/selenium/issues/6160
Adding the below it finally worked
chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService")
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.addArguments("--disable-features=VizDisplayCompositor")
I now have to setup the proxy settings manually too:
Proxy proxy = new Proxy()
proxy.setAutodetect(false)
proxy.httpProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.sslProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.socksUsername = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adUser" )
proxy.socksPassword = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adPass" )

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.

Can't run Protractor with Safari

I'm trying to solve it for days, please help me!
I'm running my protractor tests using chrome, firefox and internet explorer, but when I try to run the same test in Safari, I get the following error:
ScriptTimeoutError: Timed out awaiting response to command "executeScript" after 30003 ms (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.08 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'myPC', ip: '192.168.0.12', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=5.1.7, cssSelectorsEnabled=true, platform=WINDOWS, secureSsl=true}]
Session ID: null
The error comes when I try to get some url like browser.get('https://www.google.com'); I tried to run the same test in Safari in my colleague's macbook to see if the problem is my windows environment (and the older safari version 5.1.7) but had the same problem. I also tried to change the allScriptsTimeout and got the same problem, I tried many different configurations in my protractor configuration file and it didn't worked =(
I'm sure that I"m doing something wrong but have no ideia about what... I didn't found more information about this error.
Edit: There is a known issue (https://github.com/angular/protractor/issues/2111) about using protractor with safari

Resources