The problem

Unable to resolve the method findElementByAndroidUIAutomator with andriod driver object. Instead working fine with “MobileBy.AndroidUIAutomator(”")". is "findElementByAndroidUIAutomator " deprecated with latest version?


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);


Unresolved code


We use Ruby, not Java, and we ended up having problems finding by android uiautomator. My understanding was the problem was fixed after I ended up removing references to this call from our code. Our current solution uses by_id and by_xpath. I wish I could offer you some solution.

The appium developers have retreated from this discussion site. If you wish to talk to them about this issue, you’ll have to contact them on the slack group, or converse through git.

Thanks alot for the reply @willosser . we will also prefer xpath and id for our tests.

I have already filed same issue on Git under appium/ Java Client . I didn’t get any reply. Please help me with slack group details? Thanks in advance

There’s a threat on this site on getting added where there is a constant reminder that this is for product development only, not user support. I’d recommend staying with the ticket filed on github.

One again Thanks @willosser . I will stick to github field then

update your code to:

((AndroidDriver) driver).findElementByAndroidUIAutomator("").click();

Thanks for the reply @Aleksei. I am surprised to see why we need to cast the Android driver, I had scripts working “driver.findElementByAndroidUIAutomator(”).click()", now i was forced to cast the Android driver in eclipse and also showing as deprecated any idea ?

cause this is Android specific way to find element. all specific now differentiated between iOSdriver and AndroidDriver .


driver.findElement(MobileBy.AndroidUIAutomator("")).click(); //suggest to use this way.
((AndroidDriver) driver).findElementByAndroidUIAutomator("").click();

ok got it Thank you @Aleksei. One more help can you pleas me with the following actions, long press, drag and drop, swipe , double tap iwth touch action ?

yes. but ask when you meet problem one by one. not all together pls

Ok Sure . I will come back .Thank you.