@PramodKarande, I uninstalled the setting what u said but same error is been thrown again.
i asked you to show me first code you trying to find element.
public class Test {
public static void main(String[] args) throws MalformedURLException{
//public static AndroidDriver capabilities() throws MalformedURLException {
System.out.println(“Test”);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “GAlaxy J7 NXT”);
cap.setCapability(“udid”, “5200a8764f5ac445”); //Give Device ID of your mobile phone
cap.setCapability(“platformName”, “Android”);
cap.setCapability(“platformVersion”, “8.1.0”);
cap.setCapability(“automationName”,“uiautomator2”);
cap.setCapability(“appPackage”, “io.appium.android.apis”);
cap.setCapability(“appActivity”,".ApiDemos");
AndroidDriver driver1 = null;
driver1 = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”),cap);
driver1.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver1.findElementByXPath("//android.widget.TextView[@text=‘Preference’]").click();
}
}
automationName = appium
AndroidDriver driver1= new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”),cap);
Hopefully u might have got the solution. I am facing the same issue. Can you please help me here ?
Try to Use the below code:
driver.findElement(By.xpath("(//*[@text=‘Preference’])")).click();
or
driver.findElement(By.xpath("(//*[@class=‘android.widget.TextView’])[8]")).click();
@Ravi_Charan_Kumar @Praveena_Arumugam
I tried all xpath mentioned above, getting Exeption in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
It is opening the app but not clicking on Preference tab.
Finally able to resolve this by adding below jar files.
https://commons.apache.org/proper/commons-lang/download_lang.cgi