appium: Problems with finding elements on Android + React Native 57
The problem
Our native app is build with React Native. Our previous build was build with RN 0.54.2 and we are now upgrading to RN 0.57.2.
We had a script where we open the app, click on a feature and go to that feature. This script works with the App build with RN 0.54.2 but fails with a RN 0.57.2. The script itself has not been changed, also the Appium version has not changed (this happens on and 1.8.1
and 1.9.1
Environment
- Appium:
1.8.1||1.9.1
- Desktop: Local on OSX / Sauce Labs physical device cloud
- Node.js version:
8.9.1
- Mobile platform/version under test: Android
- Real device or emulator/simulator: Sim and Real devices (Android version is not impacting this)
- Appium CLI or Appium.app|exe: CLI
Details
I now have 2 apps, a app-54.apk
build and a app-57.apk
build. The app-54.apk
build works fine, but the app-57.apk
fails with the following log
Log
[HTTP] --> POST /wd/hub/session/c7b33a34-a356-4aa2-9f84-38f7d77580cd/elements
[HTTP] {"using":"accessibility id","value":"test-TestLink Screen"}
[debug] [MJSONWP (c7b33a34)] Calling AppiumDriver.findElements() with args: ["accessibility id","test-TestLink Screen","c7b33a34-a356-4aa2-9f84-38f7d77580cd"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Matched '/elements' to command name 'findElements'
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/1eecfb74-9a20-428a-99f6-f4c34be589db/elements] with body: {"strategy":"accessibility id","selector":"test-TestLink Screen","context":"","multiple":true}
[JSONWP Proxy] Got an unexpected response: {"sessionId":"1eecfb74-9a20-428a-99f6-f4c34be589db","status":13,"value":"java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference\n\tat io.appium.uiautomator2.model.internal.CustomUiDevice.findObjects(Custom...
[debug] [MJSONWP] Matched JSONWP error code 13 to UnknownError
[debug] [MJSONWP (c7b33a34)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.model.internal.CustomUiDevice.findObjects(CustomUiDevice.java:183)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.handler.FindElements.findElements(FindElements.java:114)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.handler.FindElements.safeHandle(FindElements.java:84)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:250)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:241)
[debug] [MJSONWP (c7b33a34)] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [MJSONWP (c7b33a34)] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
[debug] [MJSONWP (c7b33a34)] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
[debug] [MJSONWP (c7b33a34)] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
[debug] [MJSONWP (c7b33a34)] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
[debug] [MJSONWP (c7b33a34)] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
[debug] [MJSONWP (c7b33a34)] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
[debug] [MJSONWP (c7b33a34)] at java.lang.Thread.run(Thread.java:764)
[debug] [MJSONWP (c7b33a34)]
[debug] [MJSONWP (c7b33a34)] at errorFromMJSONWPStatusCode (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:789:10)
[debug] [MJSONWP (c7b33a34)] at ProxyRequestError.getActualError (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:683:14)
[debug] [MJSONWP (c7b33a34)] at /Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:234:19
[debug] [MJSONWP (c7b33a34)] at Generator.throw (<anonymous>)
[debug] [MJSONWP (c7b33a34)] at asyncGeneratorStep (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] [MJSONWP (c7b33a34)] at _throw (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:29:9)
[debug] [MJSONWP (c7b33a34)] at <anonymous>
[HTTP] <-- POST /wd/hub/session/c7b33a34-a356-4aa2-9f84-38f7d77580cd/elements 500 36 ms - 3572
I can’t seem to pinpoint the problem. Did anybody saw this problem in the past?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 47 (7 by maintainers)
I have the similar issue with the latest appium
The fix is published in module version 2.2.0
Please reinstall appium@beta and let us know if it works
Awesome, it works!!! Thanks for the quick fix!!
I’ll let you know
the fix will be available in appium@beta immediately after it is merged and the component is published
It looks like new react has just stopped providing class names of some accessibility elements, which causes unexpected NPEs when UIA2 is trying to parse them