背景信息:
Java 1.8 Appium 1.8
我已经建立了一个测试框架。
我创建了一个Java测试类来以编程方式启动appium。
我运行了代码,并收到以下错误:
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /Users/jacquelinegeorge/Documents/workspace/MobileFrame/usr/local/bin/node
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:136)
at org.openqa.selenium.remote.service.DriverService$Builder.usingDriverExecutable(DriverService.java:265)
at io.appium.java_client.service.local.AppiumServiceBuilder.usingDriverExecutable(AppiumServiceBuilder.java:443)
at aappiumLaunchServer.LaunchAppium.startAppium(LaunchAppium.java:31)
at aappiumLaunchServer.LaunchAppium.main(LaunchAppium.java:17)
问题和观察。
1 。此错误消息是什么意思? 2 。我如何解决它? 3 。如果您检查下面的代码,我想知道我是否忘记了导入某些内容?
启动Appium Java代码:
package aappiumLaunchServer;
import java.io.File;
import io.appium.java_client.service.local.AppiumServiceBuilder;
public class LaunchAppium {
private static AppiumServiceBuilder service;
public static void main(String[] args){
stopAppium();
startAppium();
stopAppium();
}
public static void startAppium(){
System.out.println("Trying to start Appium Server!");
service = new AppiumServiceBuilder().usingDriverExecutable(new File("usr/local/bin/node")).
withAppiumJS(new File(
"/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js "));
service.build().start();
System.out.println("Appium Server is at your service!");
}
public static void stopAppium(){
System.out.println("Trying to stop appium Server!");
try {
service.build().stop();
}catch (Exception e){
System.out.println("Appuim server is already stopped!");
}
System.out.println("Appuim server is now shut down!");
}
}