iOS Visible=false, 事件元素在屏幕上可见

iOS Visible=false, event elements are visible on screen

Appium:1.13.0

Xcode: 10.2

iOS: 12.1

设备(模拟器):iPhone6,iPhoneX

我有本机应用程序,运行 它在“iPhone 6,X”模拟器上。当我使用 GUI Appium 查看源代码或使用 page_source.

获取 XML 时

XCUIElementTypeCellXCUIElementTypeStaticText中的一些属性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