Appium 1.7.0 (latest one I could download), IOS with Java-client can't click on elements that where not visible on beginning


#1

Hello,

I don’t know if I’m doing something wrong or it is a bug and i can’t find a solution anywhere.

  1. I have a long table, I can click on all the cells that are visible on the beginning but i cant click on anything else, altho when i use the inspector i can see all cells still it seems that they just don’t exists when the app is running and i’m trying to click them with code.

  2. I’ve tried to scroll to the cell i want to click and then click it and this didn’t work also (I can scroll but i can’t click on it - or nothing happens)

I have no idea what to do, I can put my code but as calling the first three cells that a visible is working then I don’t see any reason that calling other cells with the same code will not work.

Anyone know how to fix this (Again, IOS XCUI, and Java-Client) or if it is something that is missing?

Thank you.


#2

What error did you get when you scrolled down to the cell and then tried to click it?

Before clicking on that cell, try to call cell.isDisplayed() and cell.isEnabled() to see if you are clicking on a correct cell you want to click (functions must return TRUE).


#3

No matter how i use it or where i write it i’m getting the Error that the node does not exists (Tried of many different nodes - table cells. All the cells that where not presented in the beginning cant be approached:

    System.out.println(iosDriver.findElement(By.xpath("//XCUIElementTypeTable/XCUIElementTypeCell[contains(@name, 'isConnected')]")).isDisplayed());
    System.out.println(iosDriver.findElement(By.xpath("//XCUIElementTypeCell[contains(@name, 'isConnected')]")).isEnabled());
    iosDriver.findElement(By.xpath("//XCUIElementTypeTable/XCUIElementTypeCell[contains(@label, 'isConnected')]")).click();

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
*** Element info: {Using=xpath, value=//XCUIElementTypeTable/XCUIElementTypeCell[contains(@name, ‘isConnected’)]}

The example i’ve given is only en example, i’ve tried many type of xPath strings, i just gave 3 deferent examples, all of them fails

The Scrolling code is as followed and it scrolls great but doesn’t stop when the element is displayed. Is stopes for few seconds thens then keeps on scrolling:

public static void scrolltoXPath(RemoteWebDriver driver, String xPath) {
    RemoteWebElement parent = (RemoteWebElement)driver.findElement(By.className("XCUIElementTypeTable")); //identifying the parent Table
    String parentID = parent.getId();
    HashMap<String, String> scrollObject = new HashMap<String, String>();
    scrollObject.put("element", parentID);

    // Use the predicate that provides the value of the label attribute
    scrollObject.put("predicateString", "label == 'isConnected'");
    driver.executeScript("mobile:scroll", scrollObject);  // scroll to the target element
}

10x


#4

Can I see that element in the Inspector tree? (Please post a screenshot) Also, are you sure you element is displayed on the screen within 10 scrolls?
Maybe what you can also try is to find element like this:

driver.findElement(By.id("isConnected"));

Problem could maybe be in java-client. Which java-client are you using?