我是appium
android 自动化的新手但是从不同的博客我已经能够开始Appium
使用 Java 在 W7 环境中配置 Android 自动化但是,不知何故我的TestNG
java 脚本没有.apk
在 android 模拟器中启动文件下面是最后几个appium
服务器显示的日志行:-
调试:在 /wd/hub/session/e4d57ac4-83df-448f-a825-dc985 4de0ed6 发起的 Appium 请求
信息:正在关闭 appium 会话...
信息:[ADB] 按下 HOME 按钮
信息:发送关闭命令,等待 ADB停止...
信息:停止 logcat 捕获
警告:Android 没有足够快地关闭,称其为已消失
信息:[ADB] 未卸载应用程序,因为服务器未使用 --full-reset
信息启动:清除 appium 设备
信息:响应成功发送给客户端: {"status":0,"value":null,"sessionId":"e 4d57ac4-83df-448f-a825-dc9854de0ed6"}
DELETE /wd/hub/session/e4d57ac4-83df-448f-a825 -dc9854de0ed6 200 7533ms - 89
下面是我的java代码: -
@BeforeMethod
public void setup() {
File appDir = new File("E:/Softwares/AppToBeTested");
File app = new File(appDir, "ContactManager.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.2.2");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
// capabilities.setCapability("app-package","com.deo.mobile1");
capabilities.setCapability("app-package","com.example.android.contactmanager");
//Here we mention the activity name, which is invoked initially as app's first page.
// capabilities.setCapability("app-activity",".StartupActivity");
capabilities.setCapability("app-activity",".ContactManager");
//capabilities.setCapability("app-wait-activity","LoginActivity,NewAccountActivity");
capabilities.setCapability("app", app.getAbsolutePath());
try {
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
@Test
public void loginTest() throws Exception
{
System.out.println("Hello");
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
注意:- 我可以看到 android 模拟器导航到主屏幕,但在那之后我已经在模拟器中安装了 ContactManager.apk,什么也没有发生