docker-maven-chrome
docker-maven-chrome copied to clipboard
Suggestion: new ChromeOptions().setHeadless(true); line from your tests is a mandatory requirement for tests to run. In absence of this, tests will fail for another project (like say mine). It could be a good idea to add it in readme.md file.
First of all, thank you for building these images. Saved me quite some time and effort. Kudos!
A suggestion:
I tried to use your DockerFile for building local images for testing selenium-chrome.
- Image build successfully.
However, for my tests, I kept getting the error (details below.
- Got errors for my test.
- 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.)
I ran with your demo
- and then I saw it was working okay.
After some careful viewing, I found that your tests have a line that made all the difference. i.e. you are making chrome options headless. If someone doesn't have this line in their tests (you can comment on this line to test) they will get the same errors.
'ChromeOptions options = new ChromeOptions() .setHeadless(true);'
Suggestion: Now this line is the only prerequisite to make your images work successfully for anyone to reuse, I think it will be a good idea to mention this in your readme.md file?
Error log:
T E S T S
Running org.hobsoft.docker.mavenchrome.BrowserTest
Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 16079
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1594905471.000][SEVERE]: bind() failed: Cannot assign requested address (99)
ChromeDriver was started successfully.
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.28 sec <<< FAILURE! - in org.hobsoft.docker.mavenchrome.BrowserTest
canDuck(org.hobsoft.docker.mavenchrome.BrowserTest) Time elapsed: 1.274 sec <<< ERROR!
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.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '3cf859c01b07', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x55bb64b8aea9
Hi Pramod, no problem, glad you find it useful!
Your analysis is correct. I've added this to the README under 'Tips' - does that help to clarify things?
Hello Mark, It does. Maybe its also good to mention the error user will face if they fail to add this option. This way, if someone searches for an answer for this issue, they can land to your page and find the right answer.What do you think? P.S: I saw a lot of posts on this topic without any good answers.
(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.)
Hello Mark, To add, in the demo -> run.sh, The commands for windows are a little different (differences are highlighted in bold):
$DOCKER_IMAGE=markhobson/maven-chrome docker pull $DOCKER_IMAGE docker run --rm -it -v ${PWD}:/usr/src -w /usr/src $DOCKER_IMAGE mvn clean verify
Maybe you want to add them too?
Hi @markhobson , thank you for this image. By the way, setHeadless()
is deprecated and adding to ChromeOptions
is the preferred method for Chrome v109+
Good to add for the README. Cheers!
Hi @kathyrollo, thanks for letting me know. I've updated the README and demo project accordingly.