Appium - In iOS after scroll it's not clicking

Hi,

I am on Mac and working with real device.
I am using Appium 1.15.1, Selenium, Java with POM.
I wrote following code for iOS swipe down.

Hi,
public void chkMenuOptioniOS1(String sName)
{
/* This is actual path which got from inspector
//XCUIElementTypeStaticText[@name=“Account Information”]
*/
String targetCell = “//XCUIElementTypeStaticText[contains(@name,’” + sName + “’)]”;
MobileElement cellWithText = driver.findElement(By.xpath(targetCell));
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put(“element”, ((RemoteWebElement)cellWithText).getId());
scrollObject.put(“direction”, “down”);
scrollObject.put(“predicateString”, “value == '” + sName + “’”);
scrollObject.put(“toVisible”, “true”);
driver.executeScript(“mobile:scroll”, scrollObject);
try {
System.out.println("In Try Block "+cellWithText.getText());
Thread.sleep(10);
cellWithText.click();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

  1. It scrolling twice
  2. and it;s not clicking,

Attaching DOM object screen capture.


Please help me

see what you do (hope it clear what need to be done to fix):

  1. find element. current position of element got X.
  2. scroll.
  3. with found element and OLD position X you trying to click on it.

Hi Aleksei,
Basically I am trying this test case.
On iOs screen I have lot of menu option and few are not displayed and one of that is “Account Information”, so I want to scroll till that element is visible and then click. So where I am going wrong.

Apart from that if if option is visible then doen’t need to scroll.