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 iOS app. And if I look through source code using GUI Appium.
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 is about: How can I do typical actions with them.
How is it possible?
What changes should Development team make to resolve this issue?

How visible=false may affect you working with item? You still can tap or getText from it.

If visible=false, then you can’t tap/click the item. It give the following exception

selenium.common.exceptions.ElementNotVisibleException: Message: The element '"Calendar_Item" StaticText' is not visible on the screen and thus is not interactable

How you make tap? Write code here pls.

I’m performing chain actions, code is

TouchAction(self.driver).press(from_element, x=0, y=0, pressure=5).perform().move_to(to_element,
                                                                             x=0, y=0).perform()

you are using TouchAction and this is good. unfortunately XCUITest is not strong point of Apple. i suggest to try:

tapOptions = new TapOptions().withElement(ElementOption.element(el));
new TouchAction(driver).tap(tapOptions).perform();

no luck -> Unable to find element on particular page of Native App by Appium

I think TapOptions is deprecated, can’t find it in import options.

i use java-client:

        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.1.0</version>
        </dependency>

which looks like latest. and import is: import io.appium.java_client.touch.TapOptions;

I’m using Appium-Python-Client, and doesn’t how TapOption in imports.

zero knowledge about python client. but suggest switch to x.y when have visibility problem

Thank you for the replies. :grinning: I’ll definitely try your suggestion & let you know.

try also -> http://appium.io/docs/en/commands/interactions/touch/tap/

1 Like

I switched to using x, y in TouchAction & it solved my problem. pasting my code here so that in future people can get utilize.

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()

3 Likes