• 关于

    阴影图可以做什么

    的搜索结果

回答

使用Appium做UI自动化测试,因为要获取到Toast信息,就用了UIAutomator2模式。登录App后,有一个设置6个密码的步骤。如下图 上面有阴影的地方就是用来输入密码。布局如下图: 我一开始的做法是想直接获取到“android.widget.LinearLayout” 然后输入6个数字的字符串。Appium能定位到元素的位置,但使用sendKey时候报了如下的错误: [JSONWP Proxy] Got an unexpected response: {"sessionId":"6098f2ff-17b6-4843-95d6-18b84cbccdfe","status":12,"value":"io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to '666666'. Did you interact with the correct element?\n\tat io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeys... [MJSONWP] Matched JSONWP error code 12 to InvalidElementStateError [MJSONWP (c790c823)] Encountered internal error running command: InvalidElementStateError: io.appium.uiautomator2.common.exceptions.InvalidElementStateException: Cannot set the element to '666666'. Did you interact with the correct element? [MJSONWP (c790c823)] at io.appium.uiautomator2.handler.SendKeysToElement.safeHandle(SendKeysToElement.java:96) [MJSONWP (c790c823)] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37) [MJSONWP (c790c823)] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:250) [MJSONWP (c790c823)] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:241) [MJSONWP (c790c823)] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) [MJSONWP (c790c823)] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) [MJSONWP (c790c823)] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435) [MJSONWP (c790c823)] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [MJSONWP (c790c823)] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [MJSONWP (c790c823)] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345) [MJSONWP (c790c823)] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366) [MJSONWP (c790c823)] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352) [MJSONWP (c790c823)] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) [MJSONWP (c790c823)] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [MJSONWP (c790c823)] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611) [MJSONWP (c790c823)] at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:514) [MJSONWP (c790c823)] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:468) [MJSONWP (c790c823)] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) [MJSONWP (c790c823)] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140) [MJSONWP (c790c823)] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [MJSONWP (c790c823)] at java.lang.Thread.run(Thread.java:833) [MJSONWP (c790c823)] [MJSONWP (c790c823)] at errorFromMJSONWPStatusCode (C:\Users\m088163\AppData\Local\Programs\Appium\resources\app\node_modules\appium-base-driver\lib\protocol\errors.js:786:12) [MJSONWP (c790c823)] at ProxyRequestError.getActualError (C:\Users\m088163\AppData\Local\Programs\Appium\resources\app\node_modules\appium-base-driver\lib\protocol\errors.js:683:14) [MJSONWP (c790c823)] at JWProxy.command (C:\Users\m088163\AppData\Local\Programs\Appium\resources\app\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:234:19) 然后我尝试定位下一级的每一个控件,然后输入密码,但还是显示是同一个错误。 第一个方法中,在Appium默认的模式下,也就是appium是可以输入内容的。 请问有什么方法可以在UIAutomator2模式下向非TextFiled控件进行sendKeys操作?。 项目环境 node.js version:v10.12.0 appium server version:v1.10.0 platform:Android Android-Version:6.0

游客6j3ztv6vbre5k 2020-01-07 15:03:17 0 浏览量 回答数 0
阿里云大学 云服务器ECS com域名 网站域名whois查询 开发者平台 小程序定制 小程序开发 国内短信套餐包 开发者技术与产品 云数据库 图像识别 开发者问答 阿里云建站 阿里云备案 云市场 万网 阿里云帮助文档 免费套餐 开发者工具 企业信息查询 小程序开发制作 视频内容分析 企业网站制作 视频集锦 代理记账服务 企业建站模板