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
getShadowRoot() method is not working in Appium Webview - The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource #1657
Comments
The error is expected. The returned object cannot be cast to WebElement, so the above statement should not work. |
@mykola-mokhnach Yes therefore we are using below new code to access the shadow dom WebElement shadowDomHostForTradeSettings = (wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//it-trade-tab//it-account-selector//ion-autocomplete")))); using above code we are getting below error The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource |
It is hard to say anything without having the full server log |
https://gist.github.com/shagupta92042/fa4ebd4409afd10cdcfe08ca613edab8 Please check the Appium server logs for the same. |
appium/appium#16538 should resolve the "no route" issue after it is published, although it will only be available in Appium2 |
Thanks @mykola-mokhnach , Could you please suggest by when latest release will be available for use with this fix ? |
Any following Appium2 version since beta.25 |
@mykola-mokhnach I tested this with Appium v2.0.0-beta.27 but still getting no route error for shadow dom elements . Please check the logs at below location |
Not sure where an error is visible. This particular request has passed as expected |
@mykola-mokhnach �[35m[HTTP]�[39m �[37m-->�[39m �[37mPOST�[39m �[37m/wd/hub/session/ec9f6a47-d6aa-4f46-836b-8ecfe0768c78/shadow/0.9815731080829553-3/element�[39m |
These are different routes. They should be added separately |
@mykola-mokhnach So how can this be resolved ? Does it requires a fix from your end ? |
I've added a PR. New routes will be available in the next server release |
@mykola-mokhnach Do we have any update this? I am also facing the same error using Appium with dotnet client. |
The problem
We are trying to test a hybrid app and we are using webview to test the same . We recently upgraded the appium client from 7.1.0 to 8.0.0 and selenium to 4.1.2 version.
While acccessing the shadow dom element the code is failing on Mobile where as the same code is working fine on Desktop Web automation . In selenium 4 , to access the shadow dom a new method was introduced which is getShadowRoot() . When we try to access the shadow element using getShadowRoot() method then we get below error
org.openqa.selenium.UnsupportedCommandException:
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_322'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [1c227afb-151c-4642-a3aa-256dbf33c2c6, getElementShadowRoot {id=0.9766494918888731-11}]
Capabilities {appium:app: D:\release.apk, appium:appActivity: com.iongroup.ionweb.activit..., appium:appPackage: com.iongroup.ionweb.agt, appium:autoGrantPermissions: true, appium:automationName: uiautomator2, appium:chromeOptions: {w3c: false}, appium:chromedriverExecutable: C:\Users\shashank.gupta\nod..., appium:databaseEnabled: false, appium:desired: {app: D:\release.apk, appActivity: com.iongroup.ionweb.activit..., appPackage: com.iongroup.ionweb.agt, autoGrantPermissions: true, automationName: uiautomator2, chromeOptions: {w3c: false}, chromedriverExecutable: C:\Users\shashank.gupta\nod..., deviceName: CVH7N16B14000292, newCommandTimeout: 60, platformName: android, platformVersion: 8.1.0}, appium:deviceApiLevel: 27, appium:deviceManufacturer: Huawei, appium:deviceModel: Nexus 6P, appium:deviceName: CVH7N16B14000292, appium:deviceScreenDensity: 560, appium:deviceScreenSize: 1440x2560, appium:deviceUDID: CVH7N16B14000292, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 60, appium:pixelRatio: 3.5, appium:platformVersion: 8.1.0, appium:statBarHeight: 84, appium:takesScreenshot: true, appium:viewportRect: {height: 2308, left: 0, top: 84, width: 1440}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: android}
When we use the belowold code which used to work with Android System webview version 95 then we get the below error
(code ) -
WebElement shadowRootForTraderAcc = (WebElement) ((JavascriptExecutor) driver).executeScript("return arguments[0].shadowRoot", shadowDomHostForTraderAcc);
(Error) -
java.lang.ClassCastException: org.openqa.selenium.remote.ShadowRoot cannot be cast to org.openqa.selenium.WebElement
Environment
Code To Reproduce Issue [ Good To Have ]
WebElement shadowDomHostForTradeSettings = (wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//it-trade-tab//it-account-selector//ion-autocomplete"))));
SearchContext shadowRootForTradeSettings = shadowDomHostForTradeSettings.getShadowRoot();
The text was updated successfully, but these errors were encountered: