Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to take screenshot of element #51

Open
Jiyvn opened this issue Mar 26, 2024 · 4 comments
Open

Not able to take screenshot of element #51

Jiyvn opened this issue Mar 26, 2024 · 4 comments

Comments

@Jiyvn
Copy link

Jiyvn commented Mar 26, 2024

Issue

404 when taking screenshot of element

Mar 26, 2024 5:52:00 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '400' -> incorrect JSON status mapping for 'unknown error' (500 expected)
When I launch viu app on LG TV # steps.lgTVDemoStepDef.LaunchViuOnLG()
org.openqa.selenium.WebDriverException: Request failed with status code 404
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.0', java.version: '17.0.7'
Driver info: io.appium.java_client.AppiumDriver
Command: [7be28ff2-6633-48b1-89b3-7551d8921b13, elementScreenshot {id=0.6263299632119397-1}]
Capabilities {appium:app: /Users/jiyvn/aviu/apps/com...., appium:appId: com.viu.tv, appium:appLaunchCooldown: 3000, appium:autoExtendDevMode: true, appium:automationName: webos, appium:chromedriverExecutable: /Users/jiyvn/aviu/apps/tv/c..., appium:debuggerPort: 9998, appium:deviceHost: 192.168.10.186, appium:deviceInfo: {boardType: LM18A_DVB_EU, firmwareVersion: 05.50.15, modelName: 43UK6500PCC, otaId: HE_DTV_W18A_AFADABAA, sdkVersion: 4.4.0}, appium:deviceName: lg2018, appium:keyCooldown: 750, appium:noReset: false, appium:rcMode: js, appium:useSecureWebsocket: false, appium:websocketPort: 3000, appium:websocketPortSecure: 3001, platformName: lgtv}
Element: [[AppiumDriver: on lgtv (7be28ff2-6633-48b1-89b3-7551d8921b13)] -> xpath: //button[@Class="button-base medium button-contained MenuButton undefined"]]
Session ID: 7be28ff2-6633-48b1-89b3-7551d8921b13
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:190)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:519)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
at org.openqa.selenium.remote.RemoteWebElement.getScreenshotAs(RemoteWebElement.java:360)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.appium.java_client.pagefactory.ElementInterceptor.getObject(ElementInterceptor.java:42)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.call(InterceptorOfASingleElement.java:79)
at io.appium.java_client.proxy.Interceptor.intercept(Interceptor.java:78)
at org.openqa.selenium.remote.RemoteWebElement$ByteBuddy$Ea7aYPfs.getScreenshotAs(Unknown Source)

code

BaseOptions options = new BaseOptions()
        .amend("appium:deviceName", "lg2018")
        .amend("platformName", "lgtv")
        .amend("appium:automationName", "webos")
        .amend("appium:deviceHost", "192.168.10.186")
        .amend("appium:noReset", false)
        .amend("appium:app", "/Users/jiyvn/aviu/apps/com.viu.tv_4.1.0_all.ipk")
        .amend("appium:appId", "com.viu.tv")
        .amend("appium:chromedriverExecutable","/Users/jiyvn/aviu/apps/tv/chromedriver/chromedriver_2.36")
        .amend("appium:rcMode", "js")   // or "rc"
        .amend("appium:useSecureWebsocket", false);
driver = new AppiumDriver(new URL("http://127.0.0.1:4723"), options);

tagetElement.getScreenshotAs(OutputType.BYTES)

logs

lg2018elementscreenshot.log

version

  • appium server version: 2.5.1
  • appium java client: 9.2.0
  • lg driver: webos@0.3.0
  • chromedriver: 2.36
@jlipps
Copy link
Collaborator

jlipps commented Mar 26, 2024

The log shows an error where your client script is sending commands to a nonexisten session. Also, your code doesn't make sense: where is targetElement defined? Finally, I'm not sure Chromedriver 2.36 is new enough to support per element screenshots.

@Jiyvn
Copy link
Author

Jiyvn commented Mar 27, 2024

@jlipps sorry, targetElement is a placeholder, actual locator is //button[@class="button-base medium button-contained MenuButton undefined"], and element id should be 0.6263299632119397-1 according to the error message provided above

@jlipps
Copy link
Collaborator

jlipps commented Mar 28, 2024

Sure, that's fine. My other two points remain relevant however.

@Jiyvn
Copy link
Author

Jiyvn commented Apr 2, 2024

@jlipps tried chromedriver 2.37-2.46, unfortunately, no one can work. Can't even start session with 2.39~2.46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants