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

问题描述 投票:0回答:2

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 appium-ios
2个回答
0
投票

在 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

0
投票

尝试使用 XCUITestOptions.SIMPLE_IS_VISIBLE_CHECK_OPTION 功能为 true 并检查。 https://github.com/appium/WebDriverAgent/commit/fa1a7c5e575c54319593d0b5e033e59ccf34dfbc

© www.soinside.com 2019 - 2024. All rights reserved.