Search code examples
appium

How to count number of elements pressent on screen


In my application i wanna count number of elements pressent in on div using appium 1.7.1 for ios
Example in my application room wise i wanna count in one room how many switches are pressent


Solution

  • I can able to count number of switches in one room.. Below code is working fine for me

    TouchAction touch1 = new TouchAction(driver);

    touch1.tap (80, 300).perform();

    List optionCount =driver.findElementsByClassName("XCUIElementTypeImage");

    System.out.println(optionCount.size()-1); Blockquote