在eclipse上运行以下源代码
import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecuteResultHandler; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import java.net.URL; import io.appium.java_client.android.AndroidDriver; public class Firstappium { static String deviceName = "Nexus9-5.1.0API22"; static WebDriver driver; static String url ="http://127.0.0.1:4720/wd/hub"; public static void main(String[] args) { DefaultExecuteResultHandler resultHandler; DesiredCapabilities capabilities = new DesiredCapabilities(); DefaultExecutor executor = new DefaultExecutor(); resultHandler = new DefaultExecuteResultHandler(); capabilities.setCapability("deviceName","Nexus9-5.1.0API22"); capabilities.setCapability("platformVersion", "5.1"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app","G:/appium/apk/cz.hipercalc.apk"); driver = new AndroidDriver(new URL(url),capabilities); System.out.println("Appium Driver is launched successfully"); } }