我正在使用appium工具测试我的应用程序。在测试过程中,Android应用程序在启动器活动附近崩溃,仅在某些版本低于8的设备中显示以下错误。
在处理命令时发生未知的服务器端错误。 原始错误:无法启动“ com.bodaty.samyata.samyata09.login.launcheractivity”或“ com.bodaty.samyata.samyata09.com.bodaty.samyata.samyata09.login.launcheractivity”从未启动。
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[JSONWP Proxy] Matched '/' to command name 'deleteSession'
[JSONWP Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/f30fa70a-c42e-45ab-bf24-5a07755da6e4] with no body
所需功能
{
"platformName": "Android",
"platformVersion": "6.0.1",
"deviceName": "Vivi Vivo 1606",
"automationName": "UiAutomator2",
"app": "/Users/Anusha/Downloads/samyata.apk"
}
答案 0 :(得分:0)
在上述错误中,未定义所需的功能“ appActivity”和“ appPackage”,这是启动应用程序所必需的。
如果要检查元素,请通过以下方式在Appium Inspector中修改所需的功能,如下所示:找到“ appActivity”和“ appPackage”
{
"platformName": "Android",
"deviceName": "Motorola",
"app": "/Users/saif.siddiqui/Desktop/SaifLearning/src/test/resources/app/Todoist_v12.8_apkpure.com.apk",
"noReset": true,
"appActivity": "com.todoist.activity.HomeActivity",
"appPackage": "com.todoist",
"automatioName": "uiautomator2"
}
如果您正在运行测试用例,然后遇到错误,请在代码中相应地修改所需的功能,如下所示:
caps.setCapability("platformName", platformName);
caps.setCapability("deviceName", deviceName);
caps.setCapability("app", uri);
caps.setCapability("noReset", true);
URL remoteUrl = new URL("http://localhost:4723/wd/hub");
caps.setCapability("appPackage", "com.todoist");
caps.setCapability("appActivity","com.todoist.activity.HomeActivity");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);