Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #24

Open
PramodKumarYadav opened this issue Jul 16, 2020 · 5 comments

Comments

@PramodKumarYadav
Copy link

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

markhobson added a commit that referenced this issue Jul 16, 2020
@markhobson
Copy link
Owner

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?

@PramodKumarYadav
Copy link
Author

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.)

@PramodKumarYadav
Copy link
Author

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?

@kathyrollo
Copy link

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!

@markhobson
Copy link
Owner

Hi @kathyrollo, thanks for letting me know. I've updated the README and demo project accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants