How to reuse the WebDriver container for all tests #7752
Unanswered
martinleim
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Until now, I have run my Selenium tests against a local Chrome. To make my tests less reliant from the host system, I want to run them in a Docker container. I managed to get it working using
BrowserWebDriverContainer
(see Webdriver Containers) - but unfortunately only if I start a new container for each test, which slows down my test suite considerably.Is there a way I can reuse the Chrome container for all tests?
My current setup
My test class looks similar to this:
Each test starts two containers
selenium/standalone-chrome
andtestcontainers/vnc-recorder
, which takes about 3 to 4 seconds:What I tried
I tried to make the
BrowserWebDriverContainer
static. The first test is successfully run, but the second hangs when trying to create theWebDriver
and after a while fails with a timeout:See standaline-chrome.log for the log of the Chrome container.
Beta Was this translation helpful? Give feedback.
All reactions