【问题标题】:Prevent appium desktop client force-stops the app防止appium桌面客户端强制停止应用
【发布时间】:2019-08-22 20:46:52
【问题描述】:

Appium桌面客户端-服务器强制停止应用

检查添加的屏幕截图中带下划线的代码

【问题讨论】:

  • 似乎 UiAutomator 正在崩溃,并且由于该崩溃 Appium 强制停止应用程序,请检查上面的“UiAutomator 意外退出”消息。我们需要完整的崩溃日志来进一步追踪这个问题。您还应该更具体地说明您想要实现的目标,并提供minimal, reproducible example,以便我们无法追踪。

标签: appium


【解决方案1】:

您可以通过提供相关的Desired Capability 从 Appium 客户端代码控制它

您要查找的名称为autoLaunch and defaults to true,只需将其设置为false,Appium 将不会停止/重新启动应用程序。

示例代码:

//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "emulator-5554");
caps.setCapability("udid", "emulator-5554"); //Give Device ID of your mobile phone
caps.setCapability("appPackage", "your.app.package");
caps.setCapability("appActivity", "your.app.package.YourAppActivity");
caps.setCapability("noReset", "true");
caps.setCapability("automationName", "uiautomator2");
caps.setCapability("autoLaunch","false"); // this one will tell Appium not to stop/start the application

AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);

只需确保您的应用正在运行或在需要时手动调用 driver.launchApp() 函数

【讨论】:

    猜你喜欢
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 2019-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多