I’m using Selenium in github action.
Nginx, MySQL, Java containers are up then pytest runs and causes error despite of not using --user-data-dir
option.
probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
In error log, Selenium points there.
@pytest.fixture(scope="module")
def driver(request):
browser = request.config.getoption("browser")
if browser == "chrome":
option = chromeOptions()
option.add_argument("--headless")
option.add_argument("--no-sandbox")
option.add_argument("--disable-dev-shm-usage")
> driver = webdriver.Chrome(options=option)
test/conftest.py:16:
And stack trace only shows up
E selenium.common.exceptions.SessionNotCreatedException: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
E Stacktrace:
E #0 0x55c68db847ca <unknown>
E #1 0x55c68d67c2f0 <unknown>
E #2 0x55c68d6b3063 <unknown>
E #3 0x55c68d6af8c6 <unknown>
E #4 0x55c68d6fcbc9 <unknown>
E #5 0x55c68d6fc216 <unknown>
E #6 0x55c68d6f0753 <unknown>
E #7 0x55c68d6bdbaa <unknown>
E #8 0x55c68d6bedfe <unknown>
E #9 0x55c68db4f38b <unknown>
E #10 0x55c68db53307 <unknown>
E #11 0x55c68db3be7c <unknown>
E #12 0x55c68db53ec7 <unknown>
E #13 0x55c68db2024f <unknown>
E #14 0x55c68db732f8 <unknown>
E #15 0x55c68db734c0 <unknown>
E #16 0x55c68db83646 <unknown>
E #17 0x7f4489294ac3 <unknown>
Chrome version:
- Google Chrome for Testing 132.0.6834.83
- ChromeDriver 132.0.6834.83
What I tried is:
- set
option.add_argument("--user-data-dir=/tmp/chrome-user-data")
- downgrade ubuntu from 24 to 22
- check chrome and chrome driver version
I have no idea to resolve it… I need your help.
2
Answers
I found that xvfb was running in different
run
block from pytest.So running xvfb in same
run
block with pytest is the solution.Thank you all..!
I am getting the same error during Selenium robot framework tests.
Can you explain in more detail how you solved it?