在Eclipse中运行脚本进行移动应用测试时,出现java.lang.NoClassDefFoundError

时间:2019-04-20 06:00:40

标签: java appium

我在eclipse中运行脚本时遇到java.lang.NoClassDefFoundError异常。但是appium可以启动应用程序,但是代码不能完全正常工作

Here is my code


   @SuppressWarnings("rawtypes")
   public static void main(String[] args) throws Throwable
   {
    DesiredCapabilities  c = new DesiredCapabilities();
    c.setCapability(CapabilityType. BROWSER_NAME, ""); 
    c.setCapability("deviceName","52034c9a5fcd9400");  
    c.setCapability("platformName", "android"); 
     c.setCapability("platformVersion","5.1.1");
    c.setCapability("appPackage", "com.sec.android.app.popupcalculator");
    c.setCapability("appActivity",  
    "com.sec.android.app.popupcalculator.Calculator");

       URL  u =new  URL("http://0.0.0.0:4723/wd/hub"); 


     AppiumDriver<MobileElement> driver = new 
      AndroidDriver<MobileElement>(u,c); 

    // driver.get("https://www.google.com/");
     Thread.sleep(15000);


     driver.findElement(By.xpath("//*[@text='8'][@index='1']")).click(); 
     driver.findElement(By.xpath("//*[@text='9'][@index='2']")).click(); 
     driver.findElement(By.xpath("//*[@content-desc='plus'] 
     [@index='3']")).click(); 
     driver.findElement(By.xpath("//*[@text='7'][@index='0']")).click(); 
     driver.findElement(By.xpath("//*[@text='4'][@index='0']")).click(); 
     driver.findElement(By.xpath("//*[@content-desc='equals'] 
     [@index='2']")).click(); 
     Thread.sleep(5000); 


     }

这是错误:

 Exception in thread "main" java.lang.NoClassDefFoundError: 
 org/apache/commons/lang3/StringUtils
 at 
 io.appium.java_client.HasSessionDetails.lambda$0(HasSessionDetails.java:49)
Caused by: java.lang.ClassNotFoundException:  
org.apache.commons.lang3.StringUtils

0 个答案:

没有答案