How to add a screenshot to allure report with python?

后端 未结 3 1783
悲&欢浪女
悲&欢浪女 2020-12-16 23:58

I have this code:

# coding: utf-8
from selenium import webdriver
import pytest
import allure


@pytest.yield_fixture(scope=\'session\')
def driver():
    _dr         


        
3条回答
  •  误落风尘
    2020-12-17 00:59

    For allure 2

    from allure_commons.types import AttachmentType
    
    allure.attach(driver.get_screenshot_as_png(), name="Screenshot", attachment_type=AttachmentType.PNG)
    

提交回复
热议问题