0

Can you please help me to resolve this screenshot issue. I have written the method which I am calling on every screen but I am getting an error while the test is running. I have tried on this question also but I could not find the answers. Here is my code for screenshot

public static boolean takeScreenshotAtEndOfTest(AndroidDriver<MobileElement> driver) {
  Timestamp timestamp = new Timestamp(System.currentTimeMillis());
  String screenshotDirectory = System.getenv("DEVICEFARM_LOG_DIR");
  File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
  return screenshot.renameTo(new File(screenshotDirectory, String.format("%s.png", timestamp)));

}

Here is the error which I am getting :

startApplication org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: The request to /screenshot has failed Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'ip-172-31-13-65', ip: '172.31.13.65', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-139-generic', java.version: '1.8.0_151' Driver info: io.appium.java_client.android.AndroidDriver Capabilities {app: /tmp/scratchjCnSt_.scratch/..., appPackage: com.company, autoGrantPermissions: true, databaseEnabled: false, desired: {app: /tmp/scratchjCnSt_.scratch/..., autoGrantPermissions: true, deviceName: Android, platformName: android, udid: HT85G1A03343}, deviceApiLevel: 28, deviceManufacturer: Google, deviceModel: Pixel 2, deviceName: HT85G1A03343, deviceScreenDensity: 420, deviceScreenSize: 1080x1920, deviceUDID: HT85G1A03343, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2.625, platform: LINUX, platformName: Android, platformVersion: 9, statBarHeight: 63, takesScreenshot: true, udid: HT85G1A03343, viewportRect: {height: 1731, left: 0, top: 63, width: 1080}, warnings: {}, webStorageEnabled: false} Session ID: 61633183-071b-4c90-9173-addf700d60b7 at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:45) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:295) at com.name.impl.CommonImpl.takeScreenshotAtEndOfTest(CommonImpl.java:207)

napendra
  • 378
  • 4
  • 12
  • 1
    Does this work locally? If so, can you try posting a run URL of a run where this issue occurs to the [AWS Device Farm](https://forums.aws.amazon.com/forum.jspa?forumID=193&start=0) forums to see if you can get help there? – Tobe E Jul 30 '20 at 01:59
  • Thanks I was able to take the screenshots. It was not working because I was trying to take the screenshot of splash screen and it was not able to take the screenshot of application splash screen because splash screen start rendering very fast and webdriver was not getting ready that time. – napendra Aug 01 '20 at 09:57

0 Answers0