selenide01---截图
阅读原文时间:2022年04月02日阅读:1
1.junit:import com.codeborne.selenide.junit.ScreenShooter;

@Rule
public ScreenShooter makeScreenshotOnFailure = ScreenShooter.failedTests();

2.testng:

import com.codeborne.selenide.testng.ScreenShooter;

@Listeners({ ScreenShooter.class})

//执行测试前执行下面代码:

ScreenShooter.captureSuccessfulTests = true;//设为true时,不管用例成功失败都截图,false时,只有失败时才会截图。

3.任何时候想要调用



screenshot("my_file_name"); //Selenide will create two files: my_file_name.png и my_file_name.html

4.设置截图文件夹,一般默认为build/reports/tests

 Configuration.reportsFolder = "test-result/reports";

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器