@pytest.fixture(scope="function") def driver(request, browser_options): wd = webdriver.Remote(command_executor=f"http://{selenoid}/wd/hub", desired_capabilities=browser_options) yield wd if request.node.rep_call.failed: allure.attach(wd.get_screenshot_as_png(), name="Screenshot", attachment_type=allure.attachment_type.PNG) wd.quit() if request.node.rep_call.failed: video = urllib.request.urlopen(f"http://{selenoid}/video/{wd.session_id}.mp4") allure.attach(body=video.read(), name="Video", attachment_type=allure.attachment_type.MP4)