我正在ubuntu(13.10)上运行最新版本的appium(1.0.0-beta.1)。当我尝试运行连接到Android模拟器的测试时,我收到以下错误。
无法启动Appium会话,错误是:错误:参数 启动应用程序信息时需要'appPackage':错误: 启动应用程序
需要参数'appPackage'info:响应客户端出错: {“status”:33,“value”:{“message”:“无法创建新会话。 (原始错误:启动时需要参数'appPackage' application)“,”origValue“:”参数'appPackage'是必需的 启动应用程序“},”sessionId“:null}
答案 0 :(得分:3)
按照以下列表匹配您的功能并使用appium 1.0:
File appDir = new File(classpathRoot, "\\lib");
File app = new File(appDir, "Demo1.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName","BX903HNX10");
capabilities.setCapability("platformVersion", "4.3");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.gorillalogic.monkeytalk.demo1");
capabilities.setCapability("appActivity",".RootActivity");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
答案 1 :(得分:1)
使用类似于以下代码(在python中)的代码创建远程webdriver时
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)`
第二个参数desired_caps应该传递“app-package”和“app-activity”值
desired_caps = {}
desired_caps['app-package'] = 'com.example.android.calculator`
desired_caps['app-activity'] = '.ApiDemos'
python中的代码片段看起来像
desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.3'
desired_caps['app'] = PATH('<path to the apk>')
desired_caps['app-package'] = 'com.example.android.calculator'
desired_caps['app-activity'] = '.ApiDemos'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)