导入pytest
将uiautomator2导入为u2
d = u2.connect()
def test_precondition():
d.press(“home”)
def test_procedure():
d(text=“Settings”).click()
d.screenshot(“Settings.png”)
d(text=“Bluetooth”).click()
d.screenshot(“Bluetooth.png”)
def test_expectedResult():
assert d(text=“Bluetooth”).exists
在上述脚本上运行为:py.test --html = report.html --self-contained-html蓝牙settings.py
我是python的新手,当我使用pytest运行上述脚本并生成HTML报告时,我无法在HTML报告中看到截图图像,要求提供解决方案