1. 程式人生 > >Appium+JAVA實現截圖功能

Appium+JAVA實現截圖功能

接觸Appium時間不長,以下是截圖方法程式碼,做個筆記備忘。

    //截圖
    public void test(WebDriver driver){
        File screen = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE);
        File screenFile = new File("d:\\screen.png");
        try {
            FileUtils.copyFile(screen,screenFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }