I have this code:
# coding: utf-8
from selenium import webdriver
import pytest
import allure
@pytest.yield_fixture(scope=\'session\')
def driver():
_dr
in your conftest.py add the following, make sure you already have a driver fixture as well:
codeblock
Instead of setting the type
as a string png
, you need to use allure module attachment type constant, which is an Enum
with extension
attribute defined:
from allure.constants import AttachmentType
allure.attach('screenshot', driver.get_screenshot_as_png(), type=AttachmentType.PNG)
For allure 2
from allure_commons.types import AttachmentType
allure.attach(driver.get_screenshot_as_png(), name="Screenshot", attachment_type=AttachmentType.PNG)