How to use findElementsByIosUIAutomation in java client 3.1.0?

@jonahss I am trying to use findElementsByIosUIAutomation method but i am getting this error.

The method findElementsByIosUIAutomation(String) is undefined for the type AppiumDriver.

Please help me to solve this.

I think AppiumDriver has been depreciated and replaced with IOSDriver/AndroidDriver.

@Yosuva

findElementsByIosUIAutomation has been moved to AndroidDriver since 2.0.0.
You can use

driver.findElements(MobileBy.ByIosUIAutomation(locator));

Hi @SergeyTichomirov
How to covert below line to current format.

driver.findElementByIosUIAutomation(".textFields()[0]").sendKeys("test123");

There is no way to covert the code automatically.

You can use

driver.findElements(MobileBy.ByIosUIAutomation(locator));

or

IOSDriver< MobileElement > driver = new IOSDriver<>(constrictor params)
//and then you are able to
driver.findElementByIosUIAutomation(“.textFields()[0]”).sendKeys(“test123”);

It seems you have used very old client (lower that 2.0.0)

please give one simple example with click operation for the below line.

driver.findElements(MobileBy.ByIosUIAutomation(locator));

Please look at this one: https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/ios/IosUIAutomationTest.java

Hi,

Just checking what is iOS predicate is, I have a question how can we use this with Page Factory annotations?

https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios_predicate.md

#Current Code
@AndroidFindBy(id = “Navigate up”)
@iOSFindBy(xpath = “//UIAButton[@name=‘Back’]”)
private MobileElement backButton;

public void clickBackButton() {
clickElement(backButton);
}

So as per predicate my new locator will be
buttons().firstWithPredicate("name BEGINSWITH ‘Back’ ")

but how can i use this in page factory ?
something like this i am expecting:
@iOSFindBy(xpath = buttons().firstWithPredicate("name BEGINSWITH ‘Back’ ")

@iOSFindBy(uiautomation="buttons().firstWithPredicate("name BEGINSWITH ‘Back’ ")

Hi Priyank,

Thanks for suggestion but i am getting compiler error with ‘uiautomation’ keyword used.

import io.appium.java_client.pagefactory.iOSFindBy;
@iOSFindBy(uiautomation=".buttons().firstWithPredicate("name BEGINSWITH ‘Back’ ") ")
private MobileElement backButton;

So I searched a bit and found following code which is not not giving compiler error but also not able to find element.
@iOSFindBy(uiAutomator=".buttons().firstWithPredicate("name BEGINSWITH ‘Back’ ") ")
private MobileElement backButton;

I am bit confused what to use uiautomation or uiAutomator in iOS and why compiler error coming with uiautomation.
Do i missing any import or any code error?

Thanks
Sheetal

Can u give sample of ur code snippet along with class names?

@Priyank_Shah: I can not use @iOSFindBy, i just see @AndroidFindBy and @SeledroidFindBy. What library i need import more ?

i think check with your java-client.