Capturing Screenshots
Posted amy2012
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Capturing Screenshots相关的知识,希望对你有一定的参考价值。
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
protected void takeScreenshot(String fileName)
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String path = System.getProperty("user.dir") + "//test-output//screenshots//" + fileName + ".png";
try
FileUtils.copyFile(scrFile, new File(path));
catch (IOException e)
e.printStackTrace();
Note: need apache commons io dependency
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
以上是关于Capturing Screenshots的主要内容,如果未能解决你的问题,请参考以下文章
使用“ ?: ”将 URL 中提供的传递参数设置为可选的 [Non-Capturing]
C# Regex ignoring non-capturing group
fiddler:The system proxy was changed.Click to reenable capturing
python 来自http://picamera.readthedocs.org/en/latest/recipes1.html#capturing-in-low-light
Fiddler - The system proxy was changed. Click to reenable capturing.