Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. @pytest.fixture(scope="function")
  2. def driver(request, browser_options):
  3.     wd = webdriver.Remote(command_executor=f"http://{selenoid}/wd/hub", desired_capabilities=browser_options)
  4.     yield wd
  5.     if request.node.rep_call.failed:
  6.         allure.attach(wd.get_screenshot_as_png(), name="Screenshot", attachment_type=allure.attachment_type.PNG)
  7.     wd.quit()
  8.     if request.node.rep_call.failed:
  9.         video = urllib.request.urlopen(f"http://{selenoid}/video/{wd.session_id}.mp4")
  10.         allure.attach(body=video.read(), name="Video", attachment_type=allure.attachment_type.MP4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement