Ubuntu 如何在Appium Robot框架中截图?

Ubuntu 如何在Appium Robot框架中截图?,ubuntu,appium,robotframework,screenshot,Ubuntu,Appium,Robotframework,Screenshot,我正在运行一个基本的测试来学习使用Robot框架的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 / 20

我正在运行一个基本的测试来学习使用Robot框架的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和robot framework拍摄一个简单的屏幕截图

更多信息:

  • 我用的是物理设备
  • 我在ubuntu上运行
  • 我正在使用Azure DevOps管道来执行脚本
更多信息:

要复制的基本脚本:

***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'

我刚刚使用了“截图页面截图”这个关键词,效果非常好