Unable to resolve findElementByAndroidUIAutomator with java client :5.0.0-BETA9 version
The problem
Unable to resolve the method findElementByAndroidUIAutomator with andriod driver object. Instead working fine with "MobileBy.AndroidUIAutomator("")". is "findElementByAndroidUIAutomator " deprecated with latest version?
Environment
Appium Java Client version : 5.0.0-BETA9 Code To Reproduce Issue
Working Code
DesiredCapabilities cap=new DesiredCapabilities(); cap.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ""); AppiumDriver driver=new AndroidDriver(new URL(""), cap);
driver.findElement(MobileBy.AndroidUIAutomator("")).click();
Unresolved code
driver.findElementByAndroidUIAutomator(").click()
@skmvali
Sorry for the delaying. I am busy. What do you expect? Yes. AppiumDriver has NO findElementByAndroidUIAutomator. It is not implemented by the AppiumDriver class but it is implemented by the AndroidDriver. So the there are two correct ways:
driver.findElement(MobileBy.AndroidUIAutomator("")).click();
as you has described
AndroidDriver driver=new AndroidDriver(new URL(""), cap);
Thanks for the reply @TikhomirovSergey
I think it is reopened by mistake. Feel free to reopen if you still hit any issues.
Hi Guys According to my understanding of polymophisim and inheritence principles
AppiumDriver driver = new AndroidDriver(capabilities,"")
driver.findElementByAndroidUIAutomator("") should call the AndroidDriver method andnot the AppiumDriver one but this is not the case
I am facing the same issue. Below is my code
File f = new File("src/test/java"); File fs = new File(f,"ApiDemos-debug.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus 6 API 28");
cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
URL url = new URL("http://127.0.0.1:4723/wd/hub");
AndroidDriver
selenium-java - 3.141.59
java-client - 7.3.0

I am also facing the same issue, any resolution for this?
@madhusmitanishu No resolution. You have to type the entire method name. Then it does not throw the error
Because findElementByAndroidUIAutomator is a default method which is supported by Java 8 onward. You are using Java 1.5 in project. Change it to 1.8 +.
@amodmahajan2016 thankyou , i changed JAVA SE 1.7 TO JAVA SE 1.8 .Now driver.findElementsByAndroidUIAutomator showing


am also facing issues here. Kindly help me on this
@joyjagan11
MobileBy is deprecated but you can use this:
driver.findElement(new AppiumBy.ByAndroidUIAutomator("text(\"Views\")")).click();