"处理命令时出现未知的服务器端错误"在打开App时

时间:2016-09-14 09:34:42

标签: appium

我使用的是Appium 1.5.3(Ara)版本。

我尝试打开本机应用并在模拟器上执行登录操作。当我从Selenium运行我的代码时,Emulator成功打开,但我的应用程序没有打开并抛出错误: "处理命令时发生未知的服务器端错误。原始错误:启动App时出错。原始错误:用于启动应用程序的活动不存在或无法启动!确保它存在且是可启动的活动(警告:服务器未提供任何堆栈跟踪信息)"

我设定的所需功能:

public void Setup() throws MalformedURLException{
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "SampleDevice");
    capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE,"com.app-salto-new");
    capabilities.setCapability("avd", "Test");
    capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
 }

Appium日志:

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"OK, shutting down","status":0}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 3.379
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/srilathakondapalli/android/platform-tools/adb with args: ["-P",5037,"-s","emulator-5554","shell","ps","uiautomator"]

1 个答案:

答案 0 :(得分:0)

在您想要的上限中使用应用启动活动 capabilities.setCapability (AndroidMobileCapabilityType.APP_ACTIVITY,"----")