Python 如何通过命令行将firefox/chrome无头模式传递给pytest

Python 如何通过命令行将firefox/chrome无头模式传递给pytest,python,selenium,pytest,pytest-selenium,Python,Selenium,Pytest,Pytest Selenium,我需要在无头模式下远程运行selenium测试用例 目前,我正在py.test命令下运行 py.test --driver remote --host selenium.host --port 4444 --capability browserName firefox --capability platform LINUX 对于headless模式,我需要在conftest.py文件中处理它 @pytest.fixture def chrome_options(chrome_options):

我需要在无头模式下远程运行selenium测试用例

目前,我正在py.test命令下运行

py.test --driver remote --host selenium.host --port 4444 --capability browserName firefox --capability platform LINUX
对于headless模式,我需要在
conftest.py
文件中处理它

@pytest.fixture
def chrome_options(chrome_options):
    chrome_options.add_argument('--headless')
    return chrome_options


@pytest.fixture
def firefox_options(firefox_options):
    firefox_options.add_argument('-headless')
    return firefox_options
但我需要在命令行中使用该选项,而不是在
conftest.py
文件中处理该选项

@pytest.fixture
def chrome_options(chrome_options):
    chrome_options.add_argument('--headless')
    return chrome_options


@pytest.fixture
def firefox_options(firefox_options):
    firefox_options.add_argument('-headless')
    return firefox_options
看看这是否有帮助