How to fix no such session chromeDriver error
In the last couple of days we moved our Ruby cucumber capybara tests to selenium 3. Such a big pain with Firefox driver and geckodriver which is not reliable at all. We are running our tests using parallel docker containers and xvfb headless browser.
Because Firefox is not stable we chose as main driver google chrome headless. The migration using google chrome was pretty easy , there was just few issues that we had to handle them in a different way.
But when we had our first build up and running in jenkins we had quite a lot of failures with no such session.
I started to dig into it and and there was couple of places coming with a solution but non of them were complete for me , so that’s why I decided to share my experience if any other people will run in the same situation like me.
Fix for no such session
Because we run our tests in docker containers , looks like dev/shm size is 64mb , so inside docker-compose.yml I added :
We also chose to run the container in privileged mode:
docker run --privileged
Running in privileged mode indeed gives the container all capabilities. But it is good practice to always give a container the minimum requirements it needs If you look at Docker docs they also refer to this flag
Full container capabilities (–privileged)
The –privileged flag gives all capabilities to the container, and it also lifts all the limitations enforced by the device cgroup controller. In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.
After all these changes you should be go to go.