mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-27 18:41:33 +08:00
change: GetForegroundApp for android device
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0+2411201330
|
||||
v5.0.0+2411201548
|
||||
|
||||
@@ -751,12 +751,17 @@ func (ad *adbDriver) GetSession() *DriverSession {
|
||||
}
|
||||
|
||||
func (ad *adbDriver) GetForegroundApp() (app AppInfo, err error) {
|
||||
packageInfo, err := ad.adbClient.RunShellCommand("CLASSPATH=/data/local/tmp/evalite", "app_process", "/", "com.bytedance.iesqa.eval_process.PackageService")
|
||||
packageInfo, err := ad.adbClient.RunShellCommand(
|
||||
"CLASSPATH=/data/local/tmp/evalite", "app_process", "/",
|
||||
"com.bytedance.iesqa.eval_process.PackageService", "2>/dev/null")
|
||||
if err != nil {
|
||||
return app, err
|
||||
}
|
||||
log.Info().Msg(packageInfo)
|
||||
err = json.Unmarshal([]byte(strings.TrimSpace(packageInfo)), &app)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Str("packageInfo", packageInfo).Msg("get foreground app failed")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user