Skip to content

Instantly share code, notes, and snippets.

@yai333
Created February 1, 2019 12:22
Show Gist options
  • Select an option

  • Save yai333/6c1d85bc1a331f670251b6d96ab2aea6 to your computer and use it in GitHub Desktop.

Select an option

Save yai333/6c1d85bc1a331f670251b6d96ab2aea6 to your computer and use it in GitHub Desktop.
import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def pytest_addoption(parser):
parser.addoption("--url", action="store", default="http://localhost", help="url")
@pytest.fixture(scope="module", autouse=True)
def browser():
options = Options()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--single-process')
options.add_argument('--disable-dev-shm-usage')
browser = webdriver.Chrome(chrome_options=options)
return browser
@pytest.fixture(scope="module")
def url(request):
return request.config.getoption("--url")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment