How to take screenshot using remote android webdriver in real device
h开发者_如何转开发i iam using andriod driver to test my product in mobile.i want to take snapshot of tests running in real device .is there any solutions?
I believe AndroidDriver extends RemoteWebDriver. RemoteWebDriver does not implement TakeScreenshot interface. Therefore you need to use augmenter like below. I never tried this on Android device but am thinking this should technically work.
driver = new AndroidDriver();
driver = (new Augmenter()).augment(driver);
File temp = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(temp, new File("C:\\my\\picture\\test.png"));
Edit#1 I checked that AndroidDriver implementes TakeScreenshot interface here. That means you don't need to augment the driver.
精彩评论