KazuCocoa / appium_dart

Appium client in Dart based on webdriver.dart
https://pub.dev/packages/appium_driver
Apache License 2.0
46 stars 14 forks source link

"InvalidElementStateException: Cannot set the element to..." with setImmediateValue() on S7 (Android 8.0) #15

Closed AnhPhamIT closed 5 years ago

AnhPhamIT commented 5 years ago

Hi KazuCocoa,

First, thank you so much for sharing this repo. Unfortunately, a "io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to 'hello'" when trying to set text as code below final xpathEmail = '//android.widget.EditText[@index=\'0\']'; var textEmail = await driver.findElement(AppiumBy.xpath(xpathEmail)); await textEmail.click(); await textEmail.setImmediateValue('hello');

Would you please have a look and let me know if you have any suggestion on this? setImmediateValue_Error appium_log.txt

Thanks, Anh Pham

KazuCocoa commented 5 years ago

Thanks. Could you attach the appium server log, too?

AnhPhamIT commented 5 years ago

Hi KazuCocoa,

I just remove some unnecessary command and update issue accordingly. Please help check on the new image and log.

Thanks, Anh Pham

KazuCocoa commented 5 years ago

thanks. Will take a look

KazuCocoa commented 5 years ago

The below error message part means the target does not allow setting texts via the command. How about typing the text against the element via sendKeys?

[debug] [W3C (32fa70e2)] Encountered internal error running command: InvalidElementStateError: io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to 'hello'. Did you interact with the correct element?
[debug] [W3C (32fa70e2)]        at io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeysToElement.java:97)
[debug] [W3C (32fa70e2)]        at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37)
[debug] [W3C (32fa70e2)]        at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)
[debug] [W3C (32fa70e2)]        at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:243)
[debug] [W3C (32fa70e2)]        at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [W3C (32fa70e2)]        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [W3C (32fa70e2)]        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
[debug] [W3C (32fa70e2)]        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
[debug] [W3C (32fa70e2)]        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
[debug] [W3C (32fa70e2)]        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
[debug] [W3C (32fa70e2)]        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
[debug] [W3C (32fa70e2)]        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
[debug] [W3C (32fa70e2)]        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
[debug] [W3C (32fa70e2)]        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
[debug] [W3C (32fa70e2)]        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
[debug] [W3C (32fa70e2)]        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
[debug] [W3C (32fa70e2)]        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
[debug] [W3C (32fa70e2)]        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
[debug] [W3C (32fa70e2)]        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
[debug] [W3C (32fa70e2)]        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
[debug] [W3C (32fa70e2)]        at java.lang.Thread.run(Thread.java:764)
KazuCocoa commented 5 years ago

note: https://github.com/appium/appium-uiautomator2-server/search?q=setText&unscoped_q=setText

AnhPhamIT commented 5 years ago

Hi KazuCocoa,

The same issue occurs when using

I assume Appium sendkeys does not work well with Flutter app. Can you you have a look?

Thanks, Anh Pham

KazuCocoa commented 5 years ago

Ah, okay. You would like to test Flutter app. https://github.com/appium/appium/pull/12945 is an experimental implementation for it.

This repository is an appium client in Dart.

KazuCocoa commented 5 years ago

https://github.com/KazuCocoa/appium_dart/issues/15#issuecomment-522227925 does not support regular Appium commands like findElement etc for flutter tho.