• Airtest IDE 自动化测试12——报告加截图 snapshot


    前言

    Airtest 生成报告的时候,每个步骤都会自动带上截图,也可以自动添加截图,使用snapshot()方法

    snapshot 方法使用

    对目标设备进行一次截图,并且保存到文件中。

     参数

    • filename - 保存截图的文件名,默认保存路径为 ST.LOG_DIR 中
    • msg - 截图文件的简短描述,将会被显示在报告页面中
    • quality - 图片的质量,[1,99]的整数,默认是10
    • max_size - 图片的最大尺寸,例如 1200

    返回:截图文件的绝对路径

    支持平台:Android,ios,Windows

    示例:

    >>> snapshot(msg="index")
    >>> # save the screenshot to test.jpg
    >>> snapshot(filename="test.png", msg="test")
    

     可以设置截图的画质和大小

    >>> # Set the screenshot quality to 30
    >>> ST.SNAPSHOT_QUALITY = 30
    >>> # Set the screenshot size not to exceed 600*600
    >>> # if not set, the default size is the original image size
    >>> ST.IMAGE_MAXSIZE = 600
    >>> # The quality of the screenshot is 30, and the size does not exceed 600*600
    >>> touch((100, 100))
    >>> # The quality of the screenshot of this sentence is 90
    >>> snapshot(filename="test.png", msg="test", quality=90)
    >>> # The quality of the screenshot is 90, and the size does not exceed 1200*1200
    >>> snapshot(filename="test2.png", msg="test", quality=90, max_size=1200)  

    截图使用

    点击app 启动图标,启动后 sleep 5秒,对app 屏幕截图

     查看报告,显示截图

     设置参数使用

    越努力,越幸运!!! good good study,day day up!!!
  • 相关阅读:
    C#与C++与互操作
    WPF GridView动态添加项并读取数据
    C#使用消息队列(MSMQ)
    使用代码浏览WPF控件模版
    PowerShell将运行结果保存为文件
    opencv + ffmpeg
    vmware
    HttpComponents Downloads
    pytorch 安装
    opencv 3.4.0 的编译
  • 原文地址:https://www.cnblogs.com/canglongdao/p/15546514.html
Copyright © 2020-2023  润新知