import pytest import os from selenium import webdriver host = os.environ.get('MAIN_HOST') @pytest.fixture(scope='function') def driver(): options = webdriver.ChromeOptions() options.add_argument('--headless') driver = webdriver.Remote( command_executor=f'http://{host}:4444/wd/hub', options=options) driver.maximize_window() yield driver driver.quit()