appium + seleniumからデバイスのローカルストレージにリアルアンドロイドデバイスから取得したスクリーンショットを保存する方法を知っていますか? ここでは、デバイスからスクリーンショットを取得してPCストレージに保存する方法があります。 実際のデバイスフォルダ(deviceName \ tablet \ GUI \ screenshots \ screenshot.jpg ...など)に保存するパスを設定するには、 のコードをPCで実行する必要があります。appium + seleniumでアンドロイドデバイスにscreenshotを保存するには
p.s.私のアプリはハイブリッドなので、スイッチコンテキストを "NATIVE_APP"にしてWEBVIEWに戻します。
public static void getScreenshot(String screenName) throws IOException {
String contextName = AppiumConfigurationTest.driver.getContext();
AppiumConfigurationTest.driver.context("NATIVE_APP");
String Screenshotpath = "C:\\!automation\\build\\reports\\gui_screen_capture\\";
File screenShot = AppiumConfigurationTest.driver.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenShot, new File(Screenshotpath + screenName+"_ " + "." + "jpg"));
AppiumConfigurationTest.driver.context(contextName);
}
答えにいくつかの説明を追加することを検討してください。詳細は、http://stackoverflow.com/help/how-to-answerを参照してください。 –
ImageIO.writeは画像をパスに保存します –