首页 > 解决方案 > iOS Visible=false,事件元素在屏幕上可见

问题描述

Appium:1.13.0

Xcode:10.2

iOS:12.1

设备(模拟器):iPhone 6、iPhone X

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

一些XCUIElementTypeCellXCUIElementTypeStaticText有属性visible=false,但它们都被显示。这只发生在应用程序的一页,其他页面工作正常。

关注点:如何与他们做典型的动作?

这怎么可能?开发团队应该做出哪些改变来解决这个问题?

标签: iosvisibilityappium-ios

解决方案


在 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

推荐阅读