Appium:1.13.0
Xcode:10.2
iOS:12.1
设备(模拟器):iPhone 6、iPhone X
我有本机应用程序并在“iPhone 6,X”模拟器上运行它。当我使用 GUI Appium 查看源代码或使用
page_source
获取 XML 时。
部分
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
尝试使用 XCUITestOptions.SIMPLE_IS_VISIBLE_CHECK_OPTION 功能为 true 并检查。 https://github.com/appium/WebDriverAgent/commit/fa1a7c5e575c54319593d0b5e033e59ccf34dfbc