enableMultiWindows and disableSuppressAccessibilityService not working simultaneously
nurdtechie98 opened this issue · 4 comments
When trying to run a session, withenableMultiWindows
and disableSuppressAccessibilityService
set to true, none of the window related commands including find element work.
Find element returns a 500 response
2022-03-25 12:56:58:810 - [HTTP] --> POST /wd/hub/session/635dbc22-ebf9-4bcd-bc4b-18def21d2cbe/element
2022-03-25 12:56:58:810 - [HTTP] {"using":"id","value":"connectivity_status"}
2022-03-25 12:56:58:811 - [debug] [MJSONWP (635dbc22)] Calling AppiumDriver.findElement() with args: ["id","connectivity_status","635dbc22-ebf9-4bcd-bc4b-18def21d2cbe"]
2022-03-25 12:56:58:811 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
2022-03-25 12:56:58:811 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2022-03-25 12:56:58:812 - [debug] [WD Proxy] Matched '/element' to command name 'findElement'
2022-03-25 12:56:58:813 - [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8203/wd/hub/session/51936b19-2176-4aca-ac9b-d265afa3a53f/element] with body: {"strategy":"id","selector":"connectivity_status","context":"","multiple":false}
2022-03-25 12:56:59:087 - [WD Proxy] Got response with status 404: {"sessionId":"51936b19-2176-4aca-ac9b-d265afa3a53f","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:68)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:41)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:262)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:256)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann...
2022-03-25 12:56:59:088 - [debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError
2022-03-25 12:56:59:091 - [debug] [MJSONWP (635dbc22)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
2022-03-25 12:56:59:091 - [debug] [MJSONWP (635dbc22)] at AndroidUiautomator2Driver.findElOrEls (/nix/store/siackc66cvr08lgsd02r2m00s4kd1303-appium-1.21.0/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/find.js:75:11)
2022-03-25 12:56:59:091 - [debug] [MJSONWP (635dbc22)] at processTicksAndRejections (internal/process/task_queues.js:97:5)
2022-03-25 12:56:59:092 - [HTTP] <-- POST /wd/hub/session/635dbc22-ebf9-4bcd-bc4b-18def21d2cbe/element 500 282 ms - 164
As soon as the disableSuppressAccessibilityService
is removed, it starts working fine.
Because of this, we are unable to test apps having multiple windows and accessibility services together.
I tried to debug the issue so as to why it might be happening.
After adding a few debug lines in the UI Automator server code and rebuilding. it looks like getWindows()
call made here is returning an empty list of windows.
Not sure so as why it might behave in such a manner
It seems like uiautomator's issue.
Appium simply sets https://developer.android.com/reference/android/app/UiAutomation#FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES as
, so how uiautomator framework behaves by this depends on Android internal.Hey @KazuCocoa ,
Thanks for taking a look. I spent some more time debugging around it. I was able to reach to the root cause, the issue seems to be due to UI Automator being initialized at multiple places and appium not passing the UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
flags at a few places.
I have created pr that fixes the same, and have tested it out locally #463 and added some more details as well.
It would be great if you could take a look, review and help me with getting it merged if seems good to you.
This issue is fixed by #463 closing this thread.