0

I'm new to coding. Currently, I am using Appium Java Eclipse.

Below is the error log.

  Nov 29, 2019 6:37:48 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
    INFO: Detected dialect: W3C
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
        at io.appium.java_client.internal.ElementMap.getElementClass(ElementMap.java:77)
        at io.appium.java_client.internal.JsonToMobileElementConverter.newRemoteWebElement(JsonToMobileElementConverter.java:67)
        at org.openqa.selenium.remote.internal.JsonToWebElementConverter.apply(JsonToWebElementConverter.java:55)
        at io.appium.java_client.internal.JsonToMobileElementConverter.apply(JsonToMobileElementConverter.java:61)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
        at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
        at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
        at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
        at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61)
        at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
        at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
        at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:151)
        at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
        at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
        at DemoActualAutomation.main(DemoActualAutomation.java:15)
    Caused by: **java.lang.ClassNotFoundException**: org.apache.commons.lang3.StringUtils
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

DemoActualAutomation.class:

import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

public class DemoActualAutomation extends AppiumDemo {
    public static void main(String[] args) throws MalformedURLException {
        // TODO Auto-generated method stub
        AndroidDriver<AndroidElement> driver = Capabilities();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();
    }

}

Am I missing something? Please help. Thank you!!

6
  • 1
    Is this when the program is built or when running in Eclipse ? Commented Nov 29, 2019 at 10:47
  • 1
    Is commons-lang3 jar file included in classpath? Commented Nov 29, 2019 at 10:48
  • 1
    It would be very helpful to see your code, where this error occurs. Commented Nov 29, 2019 at 10:48
  • Below r d codes I used import java.net.MalformedURLException; import java.util.concurrent.TimeUnit; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; public class DemoActualAutomation extends AppiumDemo{ public static void main(String[] args) throws MalformedURLException { // TODO Auto-generated method stub AndroidDriver<AndroidElement> driver=Capabilities(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click(); Commented Nov 29, 2019 at 10:51
  • - This is when running in Eclipse. - I have commons-exec and commons-lang-2.6 on my Java Build Pat Commented Nov 29, 2019 at 10:54

3 Answers 3

1
Sign up to request clarification or add additional context in comments.

Comments

1

Download the commons-lang3-3.9-bin.zip

In Eclipse, Go to your Project >Rt. Click > Build Path >Configure Build Path >Add External Jars >Select all 4 jars > Apply and Close. ur code will run...

Comments

0

org/apache/commons/lang3/StringUtils indicates you are using commons-lang3. You should add commons-lang3-xxx.jar to classpath. commons-lang-2.6 doesn't have lang3 packages.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.