click the same element twice or more, throw a uiautomator exception
See original GitHub issuewhen I click the same element twice or more, use two of the same click on the statements, or use the for statement, it will throw a exception.
sometimes before i click the element, use Thread.sleep(1000)
,it can run success, but sometime it still throw the same exception
appium version:1.6.1 appium-uiautomator2-server version: 0.0.6
org.openqa.selenium.StaleElementReferenceException: android.support.test.uiautomator.StaleObjectException at android.support.test.uiautomator.UiObject2.getAccessibilityNodeInfo(UiObject2.java:629) at android.support.test.uiautomator.UiObject2.getVisibleBounds(UiObject2.java:210) at android.support.test.uiautomator.UiObject2.getVisibleCenter(UiObject2.java:251) at android.support.test.uiautomator.UiObject2.click(UiObject2.java:343) at io.appium.uiautomator2.model.UiObject2Element.click(UiObject2Element.java:42) at io.appium.uiautomator2.handler.Click.safeHandle(Click.java:39) at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54) at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:201) at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:192) at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611) at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:514) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:468) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) at java.lang.Thread.run(Thread.java:818)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Unlike Google UiAutomator, UiAutomator2 throws
StaleObjectException
when the underlying view is changed.Please refer this: https://github.com/appium/appium-uiautomator2-server/wiki#behavioral-changes-with-respect-to-existing-appium-android-driverbootstrap
However this is something we should look into and find optimal solution.
As a work around, you can try to re find the element when the underlying view is changed.
Issue moved to appium/appium #7517 via ZenHub