fix: screenshot

This commit is contained in:
debugtalk
2022-09-26 16:01:03 +08:00
parent 66b5d5cc49
commit d4c0fc4cbd
7 changed files with 35 additions and 31 deletions
+7 -3
View File
@@ -152,10 +152,10 @@ func (dExt *DriverExt) takeScreenShot() (raw *bytes.Buffer, err error) {
return dExt.frame, nil
}
if raw, err = dExt.Driver.Screenshot(); err != nil {
log.Error().Err(err).Msgf("screenshot failed: %v", err)
log.Error().Err(err).Msg("takeScreenShot failed")
return nil, err
}
return
return raw, nil
}
// saveScreenShot saves image file to $CWD/screenshots/ folder
@@ -203,7 +203,11 @@ func (dExt *DriverExt) ScreenShot(fileName string) (string, error) {
return "", errors.Wrap(err, "screenshot by WDA failed")
}
return dExt.saveScreenShot(raw, fileName)
path, err := dExt.saveScreenShot(raw, fileName)
if err != nil {
return "", errors.Wrap(err, "save screenshot failed")
}
return path, nil
}
// isPathExists returns true if path exists, whether path is file or dir