change: remove windowSize from DriverExt

This commit is contained in:
lilong.129
2024-11-23 22:06:34 +08:00
parent 270180603c
commit 0b598fa590
3 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
v5.0.0+2411232149 v5.0.0+2411232206
+8 -5
View File
@@ -3,16 +3,19 @@ package uixt
import ( import (
"fmt" "fmt"
"github.com/httprunner/httprunner/v4/hrp/code"
"github.com/pkg/errors"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )
func (dExt *DriverExt) Drag(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) { func (dExt *DriverExt) Drag(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) {
return dExt.Driver.Drag(fromX, fromY, toX, toY, options...) windowSize, err := dExt.Driver.WindowSize()
} if err != nil {
return errors.Wrap(code.DeviceGetInfoError, err.Error())
}
width := windowSize.Width
height := windowSize.Height
func (dExt *DriverExt) DragRelative(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) {
width := dExt.windowSize.Width
height := dExt.windowSize.Height
orientation, err := dExt.Driver.Orientation() orientation, err := dExt.Driver.Orientation()
if err != nil { if err != nil {
log.Warn().Err(err).Msgf("drag from (%v, %v) to (%v, %v) get orientation failed, use default orientation", log.Warn().Err(err).Msgf("drag from (%v, %v) to (%v, %v) get orientation failed, use default orientation",
-1
View File
@@ -20,7 +20,6 @@ type DriverExt struct {
Driver IWebDriver Driver IWebDriver
ImageService IImageService // used to extract image data ImageService IImageService // used to extract image data
windowSize Size
// funplugin // funplugin
plugin funplugin.IPlugin plugin funplugin.IPlugin
} }