【问题标题】:How to attach Screen shot in Robot framework report如何在机器人框架报告中附加屏幕截图
【发布时间】:2019-08-27 16:11:28
【问题描述】:

我尝试使用 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%

screenshot

【问题讨论】:

    标签: python-3.x robotframework


    【解决方案1】:

    Take Screenshot(假设您使用来自Screenshots 库的关键字)拍摄物理屏幕而不是浏览器窗口的图片。它仅在您将实际(或虚拟)屏幕附加到运行测试的进程时才有效。

    来自Screenshots 库的文档:

    请注意,成功截取屏幕截图需要在物理或虚拟显示器上运行测试。

    【讨论】:

      【解决方案2】:

      尝试使用capture page screenshot 而不是take screenshot

      【讨论】:

      • 当我使用捕获页面截图时,报告中出现错误。“无法捕获屏幕截图,因为没有打开浏览器”。
      猜你喜欢
      • 2019-12-07
      • 2019-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-25
      • 2017-10-25
      相关资源
      最近更新 更多