【问题标题】:Need Appium code to relanch app in between test case需要 Appium 代码在测试用例之间重新启动应用程序
【发布时间】:2020-06-20 18:35:51
【问题描述】:

我是自动化新手(寻求帮助), 我的情况是 - 我需要重新启动应用程序并且必须检查最后插入的数据是否应该自动保存

driver.closeApp 不工作(我已经尝试过) 而且我不想在应用启动方法中使用此代码,我想为此创建另一种方法

【问题讨论】:

  • 在你想要的功能中 "noReset" : "false" 然后执行 driver.quit() 并使用 driver.launch() 启动应用程序

标签: android selenium-webdriver appium-android application-restart close-application


【解决方案1】:

1.您可以使用以下方法将您的应用程序置于后台,它会在10秒后自动重新启动应用程序,重新启动后应用程序将调用服务器:

 driver.runAppInBackground(Duration.ofSeconds(10));
  1. 为此会话重置当前正在运行的应用程序并等待它再次安装。

    driver.resetApp();

  2. 终止应用并再次激活,传递Android的包名称

    driver.terminateApp('com.apple.Preferences'); driver.activateApp('com.apple.Preferences');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-21
    • 2017-10-23
    • 1970-01-01
    • 2018-11-03
    • 2014-10-19
    相关资源
    最近更新 更多