is outside of element rect:

本文探讨了使用Selenium进行UI自动化测试时遇到的坐标超出元素范围的问题,详细分析了错误日志并提供了可能的解决方案。

代码

action=TouchAction(self.driver)

action.press(x=731,y=1300).wait(200).move_to(x=731,y=484).release().perform()

错误日志


selenium.common.exceptions.InvalidArgumentException: Message: Coordinate [x=731.0, y=2083.0] is outside of element rect:

在这里插入图片描述

我通过ADB命令 wm size 获取物理尺寸(设备需连接ADB),然后再次调用此方法执行clickByImage("Baidu\\video.jpg", similar=0.95),报错信息如下: command: adb -s 4TFBB25412100180 shell "getprop ro.build.version.release" [调试] real_height获取值: 2412 [调试] min_physical_y计算值: 2286.6 [调试] 模板图物理高度: 97.3 [调试] 模板图顶部Y: 2237.9(min_physical_y=2286.6) 触控流程异常,错误:Message: Coordinate [x=316.0, y=2335.20784079602] is outside of element rect: [0,0][1080,2300] Stacktrace: io.appium.uiautomator2.common.exceptions.InvalidCoordinatesException: Coordinate [x=316.0, y=2335.20784079602] is outside of element rect: [0,0][1080,2300] at io.appium.uiautomator2.utils.PositionHelper.getAbsolutePosition(PositionHelper.java:64) at io.appium.uiautomator2.utils.PositionHelper.getDeviceAbsPos(PositionHelper.java:73) at io.appium.uiautomator2.handler.Tap.safeHandle(Tap.java:53) at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:41) at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:262) at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:256) 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:1024)
07-22
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值