selenide01---截图

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";
 
 
原文地址:https://www.cnblogs.com/zipon/p/6654338.html