【问题标题】:How can i take a screenshot in Appium Robot Framework?如何在 Appium Robot Framework 中截屏?
【发布时间】:2021-07-05 16:12:52
【问题描述】:

我正在运行一个基本测试来学习使用机器人框架的 Appium,但我在捕获屏幕截图时遇到了一些问题。

这是错误:

KEYWORD Screenshot . Take Screenshot validate-terms.jpg, 80%
Documentation:  
Takes a screenshot in JPEG format and embeds it into the log file.

Start / End / Elapsed:  20210409 15:51:08.479 / 20210409 15:51:08.486 / 00:00:00.007
15:51:08.484    WARN    Taking screenshot failed: OSError: X connection failed: error 5
Make sure tests are run with a physical or virtual display. 
15:51:08.486    INFO    

我的问题是,我还需要做什么才能在 ubuntu 中使用带有机器人框架的 Appium 来截取简单的屏幕截图?

更多信息:

  • 我正在使用物理设备
  • 我在 ubuntu 上运行
  • 我正在使用 Azure DevOps Pipelines 来执行脚本

还有更多信息:

重现的基本脚本:

***Settings***

Library         AppiumLibrary
Library         Screenshot

***Test Cases***
Trying to take a screenshot
    Wait Until Element Is Visible               id=com.anything.qa:id/test_id
    Take Screenshot                             validate-terms.jpg      80%

基本 Azure DevOps 管道信息:

pool:
  vmImage: ubuntu-latest
strategy:
  matrix:
    Python37:
      python.version: '3.7'
- task: CmdLine@2
  inputs:
    script: 'pip install robotframework robotframework-appiumlibrary robotframework-screencaplibrary'
  displayName: 'Robot Install'

【问题讨论】:

    标签: ubuntu appium robotframework screenshot


    【解决方案1】:

    我刚刚使用了关键字“捕获页面截图”,效果很好!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-06
      • 1970-01-01
      • 2017-08-04
      • 2022-06-21
      • 2020-06-02
      • 2016-12-16
      • 2017-08-06
      • 2018-04-14
      相关资源
      最近更新 更多