我是新的appium,启动appium服务器后,我试图运行我的简单程序打开使用下面的代码,但我结束与错误"坏的应用程序".
public class WatsApp {
public static void main(String[] args) throws MalformedURLException {
File app = new File("E:\\appium\\APK files\\com.whatsapp.apk");
WebDriver dr;
DesiredCapabilities cap = DesiredCapabilities.android();
cap.setCapability(CapabilityType.BROWSER_NAME, "");
cap.setCapability("deviceName", "SM-N750");
cap.setCapability("platformVersion", "4.4.2");
cap.setCapability("platformName", "Android");
cap.setCapability("app", app.getAbsolutePath());
dr= new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
dr.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
dr.quit();
}
}
请帮帮我,提前谢谢
用这个
String appPath = "E:\\appium\\APK files\\com.whatsapp.apk";
cap.setCapability("app", appPath ); \\ I am assuming there is such a capability and you know about it
试试这个……
String apkpath="D:\\latest Android Apps\\Test.apk";
File app=new File(apkpath);
capabilities.setCapability("app", app.getAbsolutePath());
您是否尝试使用任何其他apk,可能是您的'com. whsapp.apk'已损坏。
如果您在目录名称之间保留空格,appiumUI应用程序将抛出错误。从编程上讲,这不是问题。