question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

click the same element twice or more, throw a uiautomator exception

See original GitHub issue

when 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:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sravanmedarapucommented, Dec 1, 2016

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.

0reactions
sravanmedarapucommented, Dec 13, 2016

Issue moved to appium/appium #7517 via ZenHub

Read more comments on GitHub >

github_iconTop Results From Across the Web

click the same element twice or more, throw a uiautomator ...
when I click the same element twice or more, use two of the same click on the statements, or use the for statement,...
Read more >
How to press a button twice using Google UiAutomator?
getBounds() multiple times on the same object doesn't seem to work. ... private void clickByText(String text) throws UiObjectNotFoundException { UiObject ...
Read more >
A brand new website interface for an even better experience!
click the same element twice or more, throw a uiautomator exception.
Read more >
androidx.compose.ui.test - Android Developers
Asserts that this collection contains at least one element that satisfies the ... Performs a double click gesture (aka a double tap) on...
Read more >
UIAutomatorViewer Tutorial: Inspect Elements On Android
This Tutorial Explains How to Download, Install & Configure UIAutomator and how to use UIAutomatorViewer to inspect Element on Android ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found