mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 06:49:38 +08:00
fix: failed to input on android device
This commit is contained in:
@@ -301,45 +301,6 @@ func (dExt *DriverExt) IsImageExist(text string) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) StartLogRecording(identifier string) error {
|
||||
if _, ok := dExt.Driver.(*wdaDriver); ok {
|
||||
log.Info().Msg("start WDA log recording")
|
||||
data := map[string]interface{}{"action": "start", "type": 2, "identifier": identifier}
|
||||
_, err := dExt.triggerWDALog(data)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to start WDA log recording")
|
||||
}
|
||||
} else {
|
||||
log.Info().Msg("start adb log recording")
|
||||
err := dExt.Driver.(*uiaDriver).logcat.CatchLogcat()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to start adb log recording")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) GetLogs() (interface{}, error) {
|
||||
if _, ok := dExt.Driver.(*wdaDriver); ok {
|
||||
log.Info().Msg("stop WDA log recording")
|
||||
data := map[string]interface{}{"action": "stop"}
|
||||
reply, err := dExt.triggerWDALog(data)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to get WDA logs")
|
||||
}
|
||||
return reply.Value, nil
|
||||
} else {
|
||||
log.Info().Msg("stop adb log recording")
|
||||
err := dExt.Driver.(*uiaDriver).logcat.Stop()
|
||||
if err != nil {
|
||||
println("failed to get adb log recording")
|
||||
//return "", errors.Wrap(err, "failed to get adb log recording")
|
||||
}
|
||||
content := dExt.Driver.(*uiaDriver).logcat.logBuffer.String()
|
||||
return ConvertPoints(content), err
|
||||
}
|
||||
}
|
||||
|
||||
var errActionNotImplemented = errors.New("UI action not implemented")
|
||||
|
||||
func (dExt *DriverExt) DoAction(action MobileAction) error {
|
||||
@@ -508,9 +469,9 @@ func (dExt *DriverExt) DoAction(action MobileAction) error {
|
||||
"enable": true,
|
||||
"data": action.Identifier,
|
||||
})
|
||||
return dExt.Driver.SendKeys(param, option)
|
||||
return dExt.Driver.Input(param, option)
|
||||
}
|
||||
return dExt.Driver.SendKeys(param)
|
||||
return dExt.Driver.Input(param)
|
||||
case CtlSleep:
|
||||
if param, ok := action.Params.(json.Number); ok {
|
||||
seconds, _ := param.Float64()
|
||||
|
||||
Reference in New Issue
Block a user