江诗 发表于 2020-11-14 14:42:52

求助:flutter 框架自动化测试时,无法输入内容

self.driver.find_element_by_xpath("//android.widget.EditText[@text='请输入工号']").click()
self.driver.find_element_by_xpath("//android.widget.EditText[@text='请输入工号']").send_keys("15112319")
点击事件可以操作成功,但是输入事件报错,报错如下:
<-- POST /wd/hub/session/6d940830-c56b-48ff-aa9f-9af689f35853/element 200 856 ms - 137

--> POST /wd/hub/session/6d940830-c56b-48ff-aa9f-9af689f35853/element/be3e6087-7e3e-4821-898e-d5595e51a58b/value
{"text":"15112319","value":["1","5","1","1","2","3","1","9"],"id":"be3e6087-7e3e-4821-898e-d5595e51a58b"}
Calling AppiumDriver.setValue() with args: [["1","5","1","1","2","3","1","9"],"be3e6087-7e3e-4821-898e-d5595e51a58b","6d940830-c56b-48ff-aa9f-9af689f35853"]
Matched '/element/be3e6087-7e3e-4821-898e-d5595e51a58b/value' to command name 'setValue'
Added 'value' property ["1","5","1","1","2","3","1","9"] to 'setValue' request body
Proxying to http://127.0.0.1:8201/wd/hub/session/b04fa774-c570-4173-ac98-a2eb517c5057/element/be3e6087-7e3e-4821-898e-d5595e51a58b/value] with body: {"elementId":"be3e6087-7e3e-4821-898e-d5595e51a58b","text":"15112319","replace":false,"value":["1","5","1","1","2","3","1","9"]}
Got response with status 400: {"sessionId":"b04fa774-c570-4173-ac98-a2eb517c5057","value":{"error":"invalid element state","message":"Cannot set the element to '15112319'. Did you interact with the correct element?","stacktrace":"io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to '15112319'. Did you interact with the correct element?\n\tat io.appium.uiautomator2.handler.SendKeysToElement.setText(SendKeysToElement.java:88)\n\tat io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeysToElement.java:119)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:41)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:253)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:247)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.net...
Matched W3C error code 'invalid element state' to InvalidElementStateError
Encountered internal error running command: io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to '15112319'. Did you interact with the correct element?
at io.appium.uiautomator2.handler.SendKeysToElement.setText(SendKeysToElement.java:88)
at io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeysToElement.java:119)
at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:41)
at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:253)
at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:247)
at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)
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.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
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.processSelectedKeysOptimized(NioEventLoop.java:552)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
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:929)


江诗 发表于 2020-11-16 19:14:57

刷新

Miss_love 发表于 2020-12-25 13:39:16

Cannot set the element to '15112319'. Did you interact with the correct element?

未找到元素
页: [1]
查看完整版本: 求助:flutter 框架自动化测试时,无法输入内容