开发者

How to take screenshot using remote android webdriver in real device

开发者 https://www.devze.com 2023-04-06 16:28 出处:网络
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 RemoteWebDriv

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号