Skip to content
Advertisement

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: https://www.youtube.com/watch?v=i1tQ1pjEFWw&t=1915s&ab_channel=edureka%21 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: http://appium.io/downloads.html.

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?

Advertisement

Answer

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

https://mvnrepository.com/artifact/io.appium/java-client/7.6.0

Good luck

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement