Karate: How to implement --no-sandbox header for linux usage with sudo - karate

I want to setup a headless chrome driver for UI Test Automation in jenkins.
But to run the test command
sudo -E java -jar karate-0.9.3.jar karate_GUI.feature
I have to run as root and it requires --no-sandbox, which, if I'm not wrong, it's still not supported in v0.9.3.
If possible, how can I include --no-sandbox option?
I checked https://intuit.github.io/karate/karate-core/ and there is no --no-sandbox option.
My feature configuration:
Feature: message end-point
Background:
* configure driver = { type: 'chrome', executable: '/usr/bin/google-chrome', headless: true }
# Login Url
* def browserManagementUrl = 'http://localhost:8000/login/'
Scenario: GUI Testing for Login page
Given driver browserManagementUrl
And eval driver.input('input[name=name]', 'admin')
And eval driver.input('input[name=password]', 'adminadmin')
And driver.submit('#login-button')
When driver.submit('#login-button')
Then match driver.location == 'http://localhost:8000/select/'
The linux command and it's results
sudo -E java -jar karate-0.9.3.jar karate_GUI.feature
07:15:56.296 [main] INFO com.intuit.karate.Main - Karate version: 0.9.3
07:15:57.345 [ForkJoinPool-1-worker-1] WARN com.intuit.karate - skipping bootstrap configuration: could not find or read file: classpath:karate-config.js
07:15:57.418 [chrome_1560323757416] DEBUG c.i.k.driver.chrome_1560323757416 - command: [/usr/bin/google-chrome, --remote-debugging-port=9222, --no-first-run, --user-data-dir=/var/jenkins_home/workspace/my-karate_GUI#2/integrations/target/chrome_1560323757416, --disable-popup-blocking, --headless]
07:15:57.419 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - poll attempt #0 for port to be ready - localhost:9222
07:15:57.420 [chrome_1560323757416] DEBUG c.i.k.driver.chrome_1560323757416 - env PATH: /sbin:/bin:/usr/sbin:/usr/bin
07:15:57.423 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - sleeping for millis: 250
07:15:57.674 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - poll attempt #1 for port to be ready - localhost:9222
07:15:57.675 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - sleeping for millis: 250
07:15:57.793 [chrome_1560323757416] DEBUG c.i.k.driver.chrome_1560323757416 - [0612/071557.791933:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
07:15:57.810 [chrome_1560323757416] DEBUG c.intuit.karate.shell.CommandThread - command complete, exit code: 1 - [/usr/bin/google-chrome, --remote-debugging-port=9222, --no-first-run, --user-data-dir=/var/jenkins_home/workspace/my-karate_GUI#2/integrations/target/chrome_1560323757416, --disable-popup-blocking, --headless]
07:15:57.926 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - poll attempt #2 for port to be ready - localhost:9222
07:15:57.927 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - sleeping for millis: 250
07:15:58.178 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - poll attempt #3 for port to be ready - localhost:9222
[...]
07:16:02.206 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - poll attempt #19 for port to be ready - localhost:9222
07:16:02.207 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - sleeping for millis: 250
07:16:02.848 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.chrome_1560323757416 - request:
1 > GET http://localhost:9222/json
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: localhost:9222
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_212)
07:16:02.862 [ForkJoinPool-1-worker-1] ERROR c.i.k.driver.chrome_1560323757416 - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1] failed: Connection refused (Connection refused), http call failed after 13 milliseconds for URL: http://localhost:9222/json
07:16:02.863 [ForkJoinPool-1-worker-1] ERROR c.i.k.driver.chrome_1560323757416 - http request failed:
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
07:16:02.918 [pool-1-thread-1] INFO com.intuit.karate.Runner - <<fail>> feature 1 of 1: karate_GUI.feature
---------------------------------------------------------
feature: karate_GUI.feature
report: target/karate_GUI.json
scenarios: 1 | passed: 0 | failed: 1 | time: 5.4993
---------------------------------------------------------
Karate version: 0.9.3
======================================================
elapsed: 6.39 | threads: 1 | thread time: 5.50
features: 1 | ignored: 0 | efficiency: 0.86
scenarios: 1 | passed: 0 | failed: 1
======================================================
failed features:
karate_GUI: karate_GUI.feature:8 -
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Exception in thread "main" picocli.CommandLine$ExecutionException: there are test failures
at com.intuit.karate.Main$1.handleExecutionException(Main.java:133)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1157)
at com.intuit.karate.Main.main(Main.java:139)

I guess you do know that the UI automation pieces are still experimental and yes I don't think we support --no-sandbox - feel free to open a ticket and help us with some links to why this is needed, what it does etc.
A suggested workaround is you can pass a batch file as the executable key to the configure driver call. In this batch file you can then call the chromedriver executable with whatever custom parameters or arguments you need.
Do let us know if that works. It also sounds to me that a way to pass any custom flags is a needed feature, do add this to your feature request.
EDIT: for those landing here in future, I'm not 100% sure, but maybe the info here will help: https://github.com/intuit/karate/issues/1134#issuecomment-638990087

Related

Does karate support headless testing in CI environment (gitlab CI)

We have done UI automation using karate framework. But I am facing challenges while trying to run the tests using gitlab pipeline.
I am using gradle build tool and added a simple step in the gitlab-ci.yaml, but the build fails every time. Here is what I tried:
Added this in feature file:
* configure driver = { type: 'chrome', headless: true }
Got the error:
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {}->http://localhost:9222
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to localhost/127.0.0.1:9222
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-8: Shutdown connection
18:10:39.056 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection discarded
18:10:39.057 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 8][route: {}->http://localhost:9222][total available: 0; route allocated: 0 of 5; total allocated: 0 of 10]
18:10:39.057 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1] failed: Connection refused (Connection refused), http call failed after 1 milliseconds for URL: http://localhost:9222
Also, tried by adding chromedriver: * configure driver = { type: 'chromedriver', port: 9515, executable: 'chromedriver' }. Got this error:
18:19:01.541 [ForkJoinPool-1-worker-1] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {}->http://localhost:9515][total available: 0; route allocated: 0 of 5; total allocated: 0 of 10]
18:19:01.542 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1] failed: Connection refused (Connection refused), http call failed after 19 milliseconds for URL: http://localhost:9515/session
18:19:01.542 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - http request failed:
org.apache.http.conn.HttpHostConnectException: Connect to localhost:9515 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
I want to execute the tests on a particular environment when pipeline runs but nothing is working as of now.
We can add the code to install chrome and chrome driver in before_script in .gitlab-ci.yml to solve the issue mentioned.
before_script:
- apt-get update && apt-get install -y --no-install-recommends google-chrome-stable
- wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- mv chromedriver /usr/bin/chromedriver
- chown root:root /usr/bin/chromedriver
- chmod +x /usr/bin/chromedriver
UI and CI is not easy, we have documented how to use the karate-chrome container: https://github.com/intuit/karate/tree/master/karate-core#karate-chrome
And others have had success with SaaS providers: https://stackoverflow.com/a/60992292/143475
If you are trying another route, you may need to do some research / digging. And please contribute your findings back to the community.

failed features: failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]

I am trying to setup karate for UI automation on Windows Laptop. I tried to run the sample code on the zip release 0.9.5 this is what I get.
failed features:
src.demo.web.google: google.feature:10 - failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]
the full stack trace is
feature: src/demo/web/google.feature:7
report: target\surefire-reports\src.demo.web.google.json
scenarios: 1 | passed: 0 | failed: 1
| time: 19.1133
---------------------------------------------------------
Karate version: 0.9.5
======================================================
elapsed: 20.17 | threads: 1 | thread time: 19.11
features: 1 | ignored: 0 | efficiency: 0.95
scenarios: 1 | passed: 0 | failed: 1
======================================================
failed features:
src.demo.web.google: google.feature:10 - failed to get reply for: [id: 6, method: Page.navigate, params: {url=https://github.com/login}]
18:43:56.084 [chrome_1595954616565] WARN com.intuit.karate.shell.Command - exit code was non-zero: 1 - [C:\Program Files (x86)\Google\Chrome\Application\chrome.exe, --remote-debugging-port=9222, --no-first-run, --user-data-dir=C:\Users\Paul\Downloads\karate-0.9.5\target\chrome_1595954616565, --disable-popup-blocking]
com.intuit.karate.exception.KarateException: there are test failures !
at ...(.)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command java -cp karate.jar com.intuit.karate.Main "c:\Users\Downloads\karate-0.9.5\src\demo\web\google.feature:7"" terminated with exit code: 1.
Please how do I over come this.
Thanks
Nearly impossible to troubleshoot given this level of information. So I suggest you follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Else here are my guesses:
maybe Chrome is not installed in the "usual" place, read the docs: https://github.com/intuit/karate/tree/master/karate-core#configure-driver
maybe your laptop has some extra security settings, so ports are blocked, try to work with some tech support. try running cmd.exe as an "Administrator"
try switching the browser / driver, again, read the docs: https://github.com/intuit/karate/tree/master/karate-core#configure-driver
don't use PowerShell - use cmd instead. see these docs also: https://github.com/intuit/karate/wiki/Karate-Robot-Windows-Install-Guide#install-visual-studio-code
That's all I can offer, the rest is up to you (or other stack overflow users) all the best.

get request returns 200 (OK), but no content in the response value part. value is [] empty

Testing started at 12:17 PM ...
"C:\Program Files\Java\jdk-11.0.3\bin\java.exe" -Dorg.jetbrains.run.directory=C:\Users\E7VJ\source\repos\Karate_Practice\Karate_Practice\Karate_Practice\src\test\java\examples\private "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=63177:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\E7VJ\source\repos\Karate_Practice\Karate_Practice\Karate_Practice\target\test-classes;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-apache\0.9.4\karate-apache-0.9.4.jar;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-core\0.9.4\karate-core-0.9.4.jar;C:\Users\E7VJ.m2\repository\com\jayway\jsonpath\json-path\2.1.0\json-path-2.1.0.jar;C:\Users\E7VJ.m2\repository\net\minidev\json-smart\2.2\json-smart-2.2.jar;C:\Users\E7VJ.m2\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\E7VJ.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\E7VJ.m2\repository\info\cukes\cucumber-java\1.2.5\cucumber-java-1.2.5.jar;C:\Users\E7VJ.m2\repository\info\cukes\cucumber-core\1.2.5\cucumber-core-1.2.5.jar;C:\Users\E7VJ.m2\repository\org\yaml\snakeyaml\1.24\snakeyaml-1.24.jar;C:\Users\E7VJ.m2\repository\de\siegmar\fastcsv\1.0.3\fastcsv-1.0.3.jar;C:\Users\E7VJ.m2\repository\info\picocli\picocli\3.0.1\picocli-3.0.1.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpclient\4.5.5\httpclient-4.5.5.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\E7VJ.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\E7VJ.m2\repository\org\apache\httpcomponents\httpmime\4.5.5\httpmime-4.5.5.jar;C:\Users\E7VJ.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\E7VJ.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\E7VJ.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\E7VJ.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\E7VJ.m2\repository\com\intuit\karate\karate-junit5\0.9.4\karate-junit5-0.9.4.jar;C:\Users\E7VJ.m2\repository\org\junit\jupiter\junit-jupiter-api\5.4.0\junit-jupiter-api-5.4.0.jar;C:\Users\E7VJ.m2\repository\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;C:\Users\E7VJ.m2\repository\org\opentest4j\opentest4j\1.1.1\opentest4j-1.1.1.jar;C:\Users\E7VJ.m2\repository\org\junit\platform\junit-platform-commons\1.4.0\junit-platform-commons-1.4.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\cucumber-java\lib\cucumber-jvmFormatter.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^test 1$" --glue com.intuit.karate C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/src/test/java/examples/private/authorization.feature
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
command: cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name ^test 1$ --glue com.intuit.karate C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/src/test/java/examples/private/authorization.feature
Warning: Nashorn engine is planned to be removed from a future JDK release
12:17:37.101 [main] INFO com.intuit.karate - found scenario at line: 8 - ^test 1$
12:17:37.350 [main] INFO com.intuit.karate - karate.env system property was: null
12:17:38.307 [main] DEBUG com.intuit.karate - request:
1 > GET https://test.nonprod-cpas.com/api/Cap?%24select=ACCT_ID&%24filter=ENTR_ID+eq+%555544433244615555%27
1 > Accept-Encoding: gzip,deflate
1 > Authorization: deleted, can not share here but can help to debug it via hangout or zoom
1 > Connection: Keep-Alive
1 > Host: test.nonprod-cpas.com
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/11.0.3)
1 > spring.jpa.show-sql: false
12:17:38.714 [main] DEBUG com.intuit.karate - response time in milliseconds: 404.78
1 < 200
1 < Connection: keep-alive
1 < Content-Length: 102
1 < Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
1 < Date: Thu, 16 Jan 2020 19:17:38 GMT
1 < OData-Version: 4.0
1 < Server: Microsoft-HTTPAPI/2.0
1 < api-supported-versions: 1.0
{"#odata.context":"https://test.nonprod-cpas.com/api/$metadata#Cap(ACCT_ID)","value":[]}
12:17:38.716 [main] INFO com.intuit.karate - [print] {
"#odata.context": "https://test.nonprod-cpas.com/api/$metadata#Cap(ACCT_ID)",
"value": [
]
}
HTML report: (paste into browser to view) | Karate version: 0.9.4
file:/C:/Users/E7VJ/source/repos/Karate_Practice/Karate_Practice/Karate_Practice/target/surefire-reports/src.test.java.examples.private.authorization.html
this is a simple get request with $ select and $ filter parameters. everything works fine in the Postman, but shows an empty value in karate. I had the same problem before with Rest-Assured / Java Framework. but I could fix it just by using a different user account for filter param. I tried the same solution with karate framework, checked 10 different user accounts for $filter param, but still got no value in json
Can you please focus your attention on the url in Karate. It has some encoding going on, e.g: %24 where it should be $
Take some time to read this: https://stackoverflow.com/a/53638335/143475
And try this:
* url 'https://test.nonprod-cpas.com/api/Cap?$select=ACCT_ID&$filter=ENTR_ID+eq+'5544433244615555'
And by the way, if that solves your problem - your server has a bug - because it should be able to handle encoded URL-s.

When karate-config.js fails it prints error for each feature

Karate-Netty version 0.9.2
Whenever my karate-config.js evaluation fails it prints:
16:49:28.753 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
16:49:28.761 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
16:49:28.762 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
<< MY SUPER AMAZING SCRIPT HERE >>
}
Note here I made if fail on purpose with trivial error just to provoke it ^
After the error it would print it for every scenario in every feature file I have, so having 55 feature files with 304 scenarios and karate-config.js with 104 lines you can imagine that this gets bad very fast.
So karate-config 5 lines long with intentional fail + 2 features with single scenario look something like this:
Generating a RSA private key
.+++++++++++++++++++++++++++
...+++++++++++++++++++++++++++
writing new private key to 'key.pem'
-----
17:06:36.217 [main] INFO com.intuit.karate.netty.Main - Karate version: 0.9.2
17:06:36.426 [main] INFO com.intuit.karate.Runner - Karate version: 0.9.2
17:06:37.434 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.435 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
karate.configure('followRedirectss', false);
// imagine having additional ~100 lines here
// and additional 54 features
}
17:06:37.436 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.554 [pool-1-thread-1] INFO com.intuit.karate.Runner - <<fail>> feature 1 of 2: src/features/null/null.feature
---------------------------------------------------------
feature: src/features/null/null.feature
report: target/src.features.null.null.json
scenarios: 1 | passed: 0 | failed: 1 | time: 0.0000
---------------------------------------------------------
17:06:37.584 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.585 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - failed function body: function fn(){
karate.configure('followRedirectss', false);
// imagine having additional ~100 lines here
// and additional 54 features
}
17:06:37.586 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
17:06:37.589 [pool-1-thread-1] INFO com.intuit.karate.Runner - <<fail>> feature 2 of 2: src/features/null/null.1.feature
---------------------------------------------------------
feature: src/features/null/null.1.feature
report: target/src.features.null.null.1.json
scenarios: 1 | passed: 0 | failed: 1 | time: 0.0000
---------------------------------------------------------
Karate version: 0.9.2
======================================================
elapsed: 1.16 | threads: 1 | thread time: 0.00
features: 2 | ignored: 0 | efficiency: 0.00
scenarios: 2 | passed: 0 | failed: 2
======================================================
failed features:
src.features.null.null: null.feature:3 - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
src.features.null.null.1: null.1.feature:3 - evaluation of 'karate-config.js' failed: javascript function call failed: unexpected 'configure' key: 'followRedirectss'
Exception in thread "main" picocli.CommandLine$ExecutionException: there are test failures
at com.intuit.karate.netty.Main$1.handleExecutionException(Main.java:133)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1157)
at com.intuit.karate.netty.Main.main(Main.java:139)
Any way to avoid this and to have fail on karate-config.js cause run to stop all together?
As you know karate-config.js is executed before every scenario. A problem with this is considered "catastrophic". Karate is designed to try and move on to the next scenario.
Feel free to open a feature request and even contribute a fix - but my guess is because of the concept of a callSingle() it would be difficult to have the logic in place to do what you are requesting.
My personal opinion is that this behavior is acceptable, if karate-config.js fails - you have to fix it rather quickly. You can always use the JUnit runner or IDE integration to work on one feature and resolve this before moving on to the whole suite.

How to fix this Selenium Error: bind() failed: Cannot assign requested address (99)

I've installed the latest version of selenium via Docker:
docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:latest
and then ran this in my python console:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver = webdriver.Remote("http://127.0.0.1:4444/wd/hub", DesiredCapabilities.CHROME)
and finally checked the docker logs:
2019-04-24 19:09:26,880 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2019-04-24 19:09:26,881 INFO supervisord started with pid 8
2019-04-24 19:09:27,865 INFO spawned: 'xvfb' with pid 11
2019-04-24 19:09:27,867 INFO spawned: 'selenium-standalone' with pid 12
19:09:28.038 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2019-04-24 19:09:28,039 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2019-04-24 19:09:28,039 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
19:09:28.093 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-04-24 19:09:28.126:INFO::main: Logging initialized #247ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:09:28.289 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
19:09:28.349 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
19:09:43.631 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"version": ""
}
19:09:43.633 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}) on port 22103
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1556132983.659][SEVERE]: bind() failed: Cannot assign requested address (99)
19:09:44.266 INFO [ProtocolHandshake.createSession] - Detected dialect: OSS
19:09:44.490 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session cedc7067c0133f6492ff65dda5c7dd88 (org.openqa.selenium.chrome.ChromeDriverService)
In particular, I'm unsure of how to fix this error:
[1556132983.659][SEVERE]: bind() failed: Cannot assign requested address (99)
I'm running this on my macbook pro using Mojave with the latest version of docker, python, and selenium. I also tried using other ports aside from 4444, same result. Thanks!
We have seen that entry in the logs for a long time, however, there is no evidence it affects your tests. The message comes directly from ChromeDriver/Chrome. It is safe to ignore it.