testcontainers-java: 1.16.1 fails for Selenium 4.0.0 and Chrome browser

I am using Selenium 4.0.0 with Chrome as web browser. When I upgrade testcontainers to 1.16.1 I get the following error:

java.lang.NoSuchMethodError: org.openqa.selenium.chrome.ChromeOptions.addArguments([Ljava/lang/String;)Lorg/openqa/selenium/chrome/ChromeOptions;
		at org.testcontainers.containers.BrowserWebDriverContainer.configure(BrowserWebDriverContainer.java:173)
		at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:322)
		at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)

The error does not exist on 1.16.0.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve tested #4609 and it works smoothly.

Thanks for reporting and investigating @derTobsch, we will look into this.

It is also broken with selenium < 4 and Firefox as browser, because since 1.16.1 the Chrome dependency is directly integrated and “ChromeOptions” is needed but not found.

see https://github.com/synyx/urlaubsverwaltung/runs/3978441190?check_suite_focus=true and the branch https://github.com/synyx/urlaubsverwaltung/tree/dependabot/maven/testcontainers.version-1.16.2

yes, BrowserWebDriverContainer is currently broking with Chrome if users have Selenium version >= 4.0.0 on their classpath