[Android Mobile] Unable to find elements in android.webkit.WebView component
See original GitHub issueThe problem
I am running testings on a React Native application. Inside that app I have a WebView component, I am trying find a certain element inside this WebView but with no success. The Appium API I tried using are:
find_element_by_xpath
find_element_by_id
find_elements_by_class_name
find_element_by_accessibility_id
The elements inspector does showing me correctly the element:
The element view in the app found in the following image, at the bottom:
Environment
- Appium version (or git revision) that exhibits the issue: 1.16.0 and 1.17.1
- Last Appium version that did not exhibit the issue (if applicable):None
- Desktop OS/version used to run Appium:CLI
- Node.js version (unless using Appium.app|exe):12.16.0
- Npm or Yarn package manager:npm
- Mobile platform/version under test: Android
- Real device or emulator/simulator:Emulator
- Appium CLI or Appium.app|exe:CLI
Details
If necessary, describe the problem you have been experiencing in more detail.
Link to Appium logs
https://assets-production.applicaster.com/qa/zapp_qa/manual/boaz/html_appium.log
Code To Reproduce Issue [ Good To Have ]
Please remember that with sample code it’s easier to reproduce the bug and it’s much faster to fix it.
Please git clone https://github.com/appium/appium and from the sample-code
directory, use one of your favourite languages and sample apps to reproduce the issue.
In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
I don’t think Appium can do much take care of them for now, unfortunately, since the root depends on how Android framework handles WebView components. So, potentially your workaround could be the only current solution until Google modifies the logic. (Or React Native side??)
https://github.com/appium/appium-uiautomator2-server/blob/c0d2d45740a2f9d05cf0e6c3b7b1a19e2f85d1b1/app/src/main/java/io/appium/uiautomator2/handler/FindElement.java#L88-L112
https://github.com/appium/appium-uiautomator2-server/blob/c0d2d45740a2f9d05cf0e6c3b7b1a19e2f85d1b1/app/src/main/java/io/appium/uiautomator2/model/internal/CustomUiDevice.java#L52
Potentially, espresso driver handles them better than uiautomator.
https://appium.io/docs/en/commands/session/source/ and https://gist.github.com/