How to run tests on remote chrome docker container

Hello friends,

I downloaded and ran the selenium standalone-chrome docker container:
https://hub.docker.com/r/selenium/standalone-chrome

Then I followed this tutorial,

and the official Katalon Documentation:


In the video tutorial (that is a solution for my topic but only in selenium - not Katalon) he is not only setting the remote url like “http://localhost:4444”,
but also the name of the browser:

DesiredCapabilities dc = new DesiredCapabilities();
dc.setBrowserName("chrome");

I also set the remote url - like it is explained in the Katalon docs.

But with only the remote url it is not working and the testcase fails:

com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: 'www.google.com'
	[...]
Caused by: 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:25:53'
System info: [...]
Driver info: driver.version: CRemoteWebDriver
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
	at com.kms.katalon.selenium.driver.CRemoteWebDriver.execute(CRemoteWebDriver.java:30)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at com.kms.katalon.selenium.driver.CRemoteWebDriver.<init>(CRemoteWebDriver.java:20)
	at com.kms.katalon.core.webui.driver.DriverFactory.createNewRemoteWebDriver(DriverFactory.java:543)
	at com.kms.katalon.core.webui.driver.DriverFactory.startRemoteBrowser(DriverFactory.java:327)
	at com.kms.katalon.core.webui.driver.DriverFactory.openWebDriver(DriverFactory.java:252)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:64)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
	at Script1657635764477.run(Script1657635764477.groovy:20)
	... 11 more
Caused by: java.net.UnknownHostException: [my companies proxy address]
	at okhttp3.Dns$1.lookup(Dns.java:40)
	at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:185)
	at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:149)
	at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:84)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:214)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at okhttp3.RealCall.execute(RealCall.java:77)
	at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CRemoteWebDriver.execute(CRemoteWebDriver.java:30)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at com.kms.katalon.selenium.driver.CRemoteWebDriver.<init>(CRemoteWebDriver.java:20)
	at com.kms.katalon.core.webui.driver.DriverFactory.createNewRemoteWebDriver(DriverFactory.java:543)
	at com.kms.katalon.core.webui.driver.DriverFactory.startRemoteBrowser(DriverFactory.java:327)
	at com.kms.katalon.core.webui.driver.DriverFactory.openWebDriver(DriverFactory.java:252)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:64)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
	at RemoteTestRun.run(RemoteTestRun:20)
	... 11 more

I think it makes totally sense to add the browsers name in the desired capabilities, to tell Katalon which browser to use on the remote system. There could have been installed more than one browser.
But sadly in the docs, there is not mentioned how to set the browser name.
I tried to add a ‘name’ - ‘value’ pair, like: “browser” - “chrome”.
But it’s not working like this.
And it’s also difficult to find a documentation about this specific topic that is not only about selenium.

But I’m sure I am not the first one trying this out and hope I will find my solution here!
Thanks!
Simon

Ok my mistake was, that I still had some proxy-settings acitve while I was not connected to this proxy. ^^
And I meanwhile found out how to set the desired capability.
I had a look into my docker container log, and got the answer I was looking for:

So I added the property “browserName” to my capability-list, and it’s working fine.

I even meanwhile found another post over here, with info about more desired capabilities you can set:

But “browserName” seems to be the only required field.

And I don’t know why you should use the headless mode on a docker container, where a fully functional browser with its gui is available.

Till now I was running my tests on our jenkins-linux-machine. There we wanted to save resources and didn’t want to install an x-server with all its dependencies only to run a browser. That’s why we needed the headless-mode.
But now I want to try it this way - running it on a remote browser in a docker container, to avoid running headless.

Hope this helps if you’re facing same issues :v:

Thank you for sharing this to our community. Happy testing @simon.klotz.

1 Like