Selenium test fails with Address in use

Hi CircleCI people,

I am running Selenium (python) tests on your stack.

Everything was fine when I just had one test class, but once adding a second class, I am getting an error message that the address is already in use.

error: [Errno 98] Address already in use

I am calling selenium with:

FUNCTIONAL_TESTS=True py.test -q -s apps/functional_tests/test_selenium.py

Is the port 8081 in use?

All functional tests run fine locally.

Thank you for any advice,
Hannes

Can you SSH into the container and run sudo netstat -plntu to see which process is using this port? Please paste the output here.

Thank you for your suggestion!

I checked the application list, but couldn’t find any firefox or chrome driver. Then I delayed the tearDown method of the first Selenium test by one second and everything seems to work fine. Is it possible that the browser driver is still in the quit process while the next test is already in the set up stage? I also change from selenium.close() to selenium.quit(), but I shouldn’t have more than one browser window at any time.

Thank you for your prompt help!

Yes this is very possible. Does delaying by 1 second fix the issue?

Yes, it did.

Thank you for your suggestions!

1 Like