iosvisibilityappium-ios

iOS Visible=false, event elements are visible on screen


Appium: 1.13.0

Xcode: 10.2

iOS: 12.1

Device (Simulators): iPhone 6, iPhone X

I have native app and run it on ‘iPhone 6, X’ simulator. When I look through source code using GUI Appium or get XML using page_source.

Some of XCUIElementTypeCell and XCUIElementTypeStaticText have attribute visible=false, but all of them are displayed. This is only happening one page of the app, other pages work fine.

Concern about: How can I do typical actions with them?

How is it possible? What changes should Development team make to resolve this issue?


Solution

  • in case of iOS you can't click & tap an element if visibility=false is, so a work around is to use TouchAction using x, y. Code is written in 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()
    

    you can import TouchAction using

    from appium.webdriver.common.touch_action import TouchAction