我尝试使用Take Screenshot关键字将屏幕快照附加到机器人框架中 出现类似日志中的错误
Taking screenshot failed: Taking screenshots is not supported on this platform by default. See library documentation for details.
Make sure tests are run with a physical or virtual display"
我在机器人框架测试用例中使用“ Take Screenshot product.jpg 80%”
*** Settings ***
Library File.py
Library SeleniumLibrary
Library SeleniumScreenshots
Library Screenshot
*** Test Cases ***
Add product to the Shopping Cart
Search the product in home page
Select first product
#Capture page screenshot product.png
Take Screenshot product.jpg 80%
Select the size of product
Select the product to shopping cart
Take Screenshot Cart.png 80%
答案 0 :(得分:1)
Take Screenshot
(假设您使用的是Screenshots库中的关键字)将为物理屏幕而不是浏览器窗口拍照。仅当您在运行测试的进程中附加了实际(或虚拟)屏幕时,该方法才有效。
来自Screenshots库的文档:
请注意,成功拍摄屏幕快照要求测试必须在物理或虚拟显示器上进行。
答案 1 :(得分:0)
尝试使用capture page screenshot
代替take screenshot
。