iOS - Clicking the clear X button on UISearchBar

Hello,

  1. Is there a way to determine if the UISearchBar X (clear) button appeared?
  2. How click on it programmatically?

Please see screenshot.

http://postimg.org/image/jh8821ylv/

Thanks.

Please go to inspector and look for the X element. Any doubt, take a print of inspector

Use inspector, as mentioned previously, or use driver.getPageSource() (for Java), driver.page_source (for Ruby) to get source code.

You can try like this

if (driver.findElements(By.className(“Class Name shown in type field of Appium Inspector”)).size()>0)
driver.findElement(By.className(“Class Name shown in type field of Appium Inspector”).click()