ios - iOS Visible=false,事件元素在屏幕上可见
问题描述
Appium:1.13.0
Xcode:10.2
iOS:12.1
设备(模拟器):iPhone 6、iPhone X
我有本机应用程序并在“iPhone 6,X”模拟器上运行它。当我使用GUI Appium查看源代码或使用page_source
.
一些XCUIElementTypeCell
和XCUIElementTypeStaticText
有属性visible=false
,但它们都被显示。这只发生在应用程序的一页,其他页面工作正常。
关注点:如何与他们做典型的动作?
这怎么可能?开发团队应该做出哪些改变来解决这个问题?
解决方案
在 iOS 的情况下,如果是,则无法单击并点击元素visibility=false
,因此解决方法是使用 x,y 使用 TouchAction。代码写在python
def touch_on_element(self, element):
x_position = element.location['x'] + element.size['width'] / 2
y_position = element.location['y'] + element.size['height'] / 2
TouchAction(self.driver).tap(x=x_position, y=y_position).perform()
TouchAction
您可以使用导入
from appium.webdriver.common.touch_action import TouchAction
推荐阅读
- c++ - 通过 SHELLEXECUTEINFO 向 .exe 发送参数
- javascript - InnerHTML- 从脚本中获取
- python - 我发现这个错误参数'string'的类型不正确(预期的str,得到了numpy.ndarray)
- javascript - 导入 Mockingoose 时,Mongoose 查询返回未定义
- python - 在 CANoe 中使用 comtypes 运行 CAPL 函数会出错
- python-3.x - 通过 Selenium 在 Chrome 的地址栏中输入文本
- javascript - 悬停浏览器元素会破坏展开/折叠侧边栏上的悬停功能
- node.js - 尝试将日期时间字段转换为 SQL Server 查询的日期时,Nodejs 服务返回日期时间而不仅仅是日期
- android - MediaButtonReceiver 不与 MediaSession 一起使用
- nginx - 带有magento 1.9的Nginx Wordpress