MobileElement not exist in java-client 8.0.0

I can't find a way to import MobileElement for code I copy after following this guide: in Appium for testing Android.

import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.MobileElement; public class Test { public static void main(String args[]){ MobileElement el3 = (MobileElement) driver.findElementById("com.example.calculator:id/button2"); el3.click(); MobileElement el4 = (MobileElement) driver.findElementById("com.example.calculator:id/button5"); el4.click(); MobileElement el5 = (MobileElement) driver.findElementById("com.example.calculator:id/buttonPlus"); el5.click(); MobileElement el6 = (MobileElement) driver.findElementById("com.example.calculator:id/button3"); el6.click(); MobileElement el7 = (MobileElement) driver.findElementById("com.example.calculator:id/button9"); el7.click(); } } 

But the recorded code has MobileElement, so I do the same by downloading libraries from this site: .

This is my library which was downloaded from appium.io

But later, it showed me that it doesn't have MobileElement library, so I can't import it.

Cannot resolve symbol 'MobileElement'

Is it because the code is old or does the library have an update that I don't know?

2 Answers

Appium java-client v8 uses Selenium4 and introduces a lot of breaking changes.

You can look here .

It's recommended to use WebElement interface type instead of MobileElement.

Appium java-client v8 seems to be W3C compliant. So moving to a new API is a step into the future. At least after final 8.0.0 release (it's beta right now).

I am doing the same thing. My solution is to switch to released java-client, not the beta version.

implementation files('libs\\java-client-7.6.0.jar') 

Good luck

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like