diff --git a/setup.cfg b/setup.cfg index eb55b0d..b18d4b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ automation_linting = botright selenium selenium_driverless + webdriver-manager testing = pytest mypy @@ -53,3 +54,4 @@ testing = botright selenium selenium_driverless + webdriver-manager diff --git a/tests/conftest.py b/tests/conftest.py index 55e388b..9a4ca04 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,9 @@ import pytest import pytest_asyncio +from webdriver_manager.chrome import ChromeDriverManager from selenium import webdriver as selenium_webdriver +from selenium.webdriver.chrome.service import Service as SeleniumChromeService from playwright.async_api import Page as AsyncPage from playwright.async_api import async_playwright from playwright.sync_api import Page as SyncPage @@ -133,15 +135,18 @@ def sync_driver() -> Generator[sync_webdriver.Chrome, None, None]: @pytest.fixture def selenium_driver() -> Generator[selenium_webdriver.Chrome, None, None]: options = selenium_webdriver.ChromeOptions() + for flag in flags: + options.add_argument(flag) - # disable logs - options.add_experimental_option('excludeSwitches', ['enable-logging']) + # disable logs & automation + options.add_experimental_option('excludeSwitches', ['enable-logging', "enable-automation"]) + options.add_experimental_option('useAutomationExtension', False) options.add_argument("--log-level=3") - for flag in flags: - options.add_argument(flag) + # start url at about:blank + options.add_argument("about:blank") - with selenium_webdriver.Chrome(options) as driver: + with selenium_webdriver.Chrome(options,service=SeleniumChromeService(ChromeDriverManager().install())) as driver: driver.sync_input = SyncInput(browser=driver) yield driver