#需要导入的包
from airtest.aircv import *
from airtest.aircv.utils import cv2_2_pil
screen1 = G.DEVICE.snapshot()
screen1 = aircv.crop_image(screen1, (100, 156, 2500, 800))
pil_img = cv2_2_pil(screen1)
img_path = BASE_PATH + fr"\output\imgs\{name}_{dates}.png"
pil_img.save(img_path, quality=99, optimize=True)
allure.attach.file(img_path, name="截图",attachment_type=allure.attachment_type.PNG, extension=".png")
python语法