首页 > 解决方案 > django pytest splinter selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

问题描述

I'm trying to use pytest-bdd and pytest-splinter together.

I use docker and docker-compose.

This is my pytest pluging:

sugar-0.9.1, splinter-2.0.0, mock-1.10.0, django-3.4.2, bdd-2.21.0, celery-4.2.1

It's my fixtures:

@pytest.fixture(scope="session")
def splinter_webdriver():
    return "chrome"

@pytest.fixture(scope="session")
def splinter_headless():
    return True

And if I try to run the tests, I get the following error:

E       selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
E         (unknown error: DevToolsActivePort file doesn't exist)
E         (The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
E         (Driver info: chromedriver=2.38 (05121428cd0fc129e40a3694cf5405698236ad14),platform=Linux 4.9.122-1-MANJARO x86_64)

I install chromedriver like this:

  && apk add chromium chromium-chromedriver

For this, most likely, the latest version is installed.

I tried many different options, but I still could not solve the problem.

Also, an obstacle in solving the problem was that I can not pass on all the options that I want.

Most of the answers I find relate to the use of pure Selenium or Splinter. But I'm interested in using exactly the pytest-splinter.

标签: pythondjangoseleniumpytest

解决方案


推荐阅读