如何在appium服务器中设置应用程序路径?

时间:2016-12-22 10:44:48

标签: android windows eclipse appium

File app = new File ( appDir );
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability ( MobileCapabilityType.BROWSER_NAME, "" );
capabilities.setCapability ( MobileCapabilityType.DEVICE_NAME, "1262dec2" );
capabilities.setCapability ( MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID );
capabilities.setCapability( MobileCapabilityType.PLATFORM_VERSION, "5.1.1" );
capabilities.setCapability( MobileCapabilityType.AUTOMATION_NAME, "appium" );
capabilities.setCapability( MobileCapabilityType.APPIUM_VERSION, "1.4.16.1" );
capabilities.setCapability( MobileCapabilityType.APP, app );
driver = new AndroidDriver( new URL("http://127.0.0.1:4723//wd//hub" ), capabilities);

当我在eclipse中运行上面的代码时,它显示以下错误

  

info:[debug]响应客户端我们找不到有效资源

我已经尝试了很长时间的所有功能。任何人都可以帮忙解决问题吗?

1 个答案:

答案 0 :(得分:0)

你应该有.apk文件,并在windows上提供mac(/filename.apk)文件路径中的路径(\ filename.apk) 例如:

String apkpath="/Users/fidel/Downloads/Test.apk";
File app=new File(apkpath);

然后设置以下功能

capabilities.setCapability("app", app.getAbsolutePath());

连接设备并配对系统 运行Appium(你可以看到登录Appium)