【发布时间】:2015-07-21 10:09:16
【问题描述】:
我正在尝试使用 selenium 和 firefox 捕获 http://www.flipkart.com url 的屏幕。
public class App {
private static final String APP_URL = "http://www.flipkart.com";
public static void main(String[] args) {
WebDriver webDriver = null;
try {
webDriver = new FirefoxDriver();
webDriver.get(APP_URL);
webDriver.manage().window().maximize();
if (webDriver instanceof TakesScreenshot) {
TakesScreenshot screenshot = (TakesScreenshot) webDriver;
File imageFile = screenshot.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(imageFile, new File(
"C:\\Captures\\captured.png"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (webDriver != null) {
webDriver.quit();
}
}
}
}
它需要整个页面的屏幕截图,但内页显示图像对于许多其他图像不可用。我无法纠正它。帮帮我。
【问题讨论】:
标签: java selenium selenium-webdriver