Appium:将应用程序置于后台超过120秒时,执行两次在后台运行应用程序命令

时间:2019-02-19 05:43:02

标签: java automation appium

将应用程序置于后台120秒后,我可以看到runAppInBackground命令执行了两次。 (也尝试了119秒。其行为方式相同)。但是,当我将应用置于后台115秒钟时,该应用仅执行一次-可以正常运行。 当appium第二次执行runAppInBackground命令时,您会在日志中看到adb命令adb shell猴子。我可以知道这里是什么问题吗?

我已经尝试在android设备上使用最新的appium版本:1.11.0。在较旧的版本中,增加背景时间也遇到相同的问题。

将应用置于后台120秒

  

driver.runAppInBackground(Duration.ofSeconds(120))

[HTTP] --> POST /wd/hub/session/b8a82cab-0535-434b-b9c6-ea7cb97ee582/appium/app/background
[HTTP] {“seconds”:120}
[debug] [W3C (b8a82cab)] Calling AppiumDriver.background() with args: [120,“b8a82cab-0535-434b-b9c6-ea7cb97ee582”]
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell dumpsys window windows’
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell input keyevent 3’

TRYING SECOND TIME:
[debug] [AndroidDriver] Activating app ‘x.x.x’ in order to restore it
[debug] [AndroidDriver] Activating ‘x.x.x’ with ‘adb shell monkey -p x.x.x -c android.intent.category.LAUNCHER 1’ command
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell monkey -p x.x.x -c android.intent.category.LAUNCHER 1’
[HTTP] <-- POST /wd/hub/session/b8a82cab-0535-434b-b9c6-ea7cb97ee582/appium/app/background - - ms - -
[HTTP]
[HTTP] --> POST /wd/hub/session/b8a82cab-0535-434b-b9c6-ea7cb97ee582/appium/app/background
[HTTP] {“seconds”:120}
[debug] [W3C (b8a82cab)] Calling AppiumDriver.background() with args: [120,“b8a82cab-0535-434b-b9c6-ea7cb97ee582”]
[debug] [AndroidDriver] Command stdout: Events injected: 1
[debug] [AndroidDriver] ## Network stats: elapsed time=28ms (0ms mobile, 0ms wifi, 28ms not connected)
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell dumpsys window windows’
[debug] [W3C (b8a82cab)] Responding to client with driver.background() result: true
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell input keyevent 3’
[debug] [AndroidDriver] Activating app ‘x.x.x’ in order to restore it
[debug] [AndroidDriver] Activating ‘x.x.x’ with ‘adb shell monkey -p x.x.x -c android.intent.category.LAUNCHER 1’ command
[debug] [ADB] Running ‘/home/anto/Android/Sdk/platform-tools/adb -P 5037 -s ce12171cd031b8050c shell monkey -p x.x.x -c android.intent.category.LAUNCHER 1’
[debug] [AndroidDriver] Command stdout: Events injected: 1
[debug] [AndroidDriver] ## Network stats: elapsed time=23ms (0ms mobile, 0ms wifi, 23ms not connected)
[debug] [W3C (b8a82cab)] Responding to client with driver.background() result: true
[HTTP] <-- POST /wd/hub/session/b8a82cab-0535-434b-b9c6-ea7cb97ee582/appium/app/background 200 121545 ms - 14

0 个答案:

没有答案