refactor: XTDriver

This commit is contained in:
lilong.129
2025-02-11 15:34:51 +08:00
parent b35116fdf7
commit 72f7b77bc8
28 changed files with 100 additions and 121 deletions

View File

@@ -74,7 +74,7 @@ func (dExt *XTDriver) GetScreenResult(opts ...option.ActionOption) (screenResult
continue
}
windowSize, err = dExt.Driver.WindowSize()
windowSize, err = dExt.WindowSize()
if err != nil {
lastErr = errors.Wrap(code.DeviceGetInfoError, err.Error())
continue
@@ -101,7 +101,7 @@ func (dExt *XTDriver) GetScreenResult(opts ...option.ActionOption) (screenResult
}
// cache screen result
dExt.Driver.GetSession().addScreenResult(screenResult)
dExt.GetSession().addScreenResult(screenResult)
if imageResult != nil {
screenResult.Texts = imageResult.OCRResult.ToOCRTexts()
@@ -200,7 +200,7 @@ func (dExt *XTDriver) FindUIResult(opts ...option.ActionOption) (point ai.PointF
// GetScreenShot takes screenshot and saves image file to $CWD/screenshots/ folder
func (dExt *XTDriver) GetScreenShot(fileName string) (raw *bytes.Buffer, path string, err error) {
if raw, err = dExt.Driver.Screenshot(); err != nil {
if raw, err = dExt.Screenshot(); err != nil {
log.Error().Err(err).Msg("capture screenshot data failed")
return nil, "", errors.Wrap(code.DeviceScreenShotError, err.Error())
}