【问题标题】:How to push app in background and launch from same screen in Appium with selenium Put app in background. Open the app from same screen如何在后台推送应用程序并在 Appium 中使用 selenium 从同一屏幕启动 将应用程序置于后台。从同一屏幕打开应用程序
【发布时间】:2019-08-31 02:33:29
【问题描述】:

如何在 Appium 中使用 selenium 在后台推送应用程序并从同一屏幕启动

从某个特定屏幕按主页按钮。将应用程序置于后台。一段时间后从同一屏幕打开应用程序

在这里,我可以通过下面的代码在后台设置应用程序,但找不到使用上次访问页面将应用程序置于前台的方法,目前使用下面的代码方法,应用程序正在通过初始登录屏幕重新启动。任何人都可以帮忙吗?

代码1:

driver.runAppInBackground(Duration.ofSeconds(15));
2.Activity activity = new Activity(“com.gisteam.rjiomaps.projectresq”, “com.gisteam.rjiomaps.projectresq.main.MapFragmentActivity”);//activity name is as per the last visited page
3.activity.setStopApp(false);
((AndroidDriver) driver).startActivity(activity);

代码2

1.driver.runAppInBackground(Duration.ofSeconds(15));
2.((AndroidDriver) driver).currentActivity();

【问题讨论】:

标签: selenium appium appium-android


【解决方案1】:
  1. 安装应用程序并导航到应用程序上的所需屏幕,使用 adb 键码作为主页按钮最小化应用程序 adb shell input keyevent 3

  2. 再次打开应用程序而不安装,使用 adb 命令启动活动,如下例所示

adb shell am start -n com.example.package(把你的包名放在这里)/.MainActivity(要启动的活动)

【讨论】:

    猜你喜欢
    • 2016-09-08
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    • 1970-01-01
    • 2011-12-10
    相关资源
    最近更新 更多