refactor: restructure

This commit is contained in:
debugtalk
2022-09-23 21:19:12 +08:00
parent 35225d97ff
commit e3d0eccde5
18 changed files with 624 additions and 511 deletions
+5 -2
View File
@@ -2,6 +2,7 @@ package uixt
import (
"fmt"
"time"
"github.com/electricbubble/gwda"
"github.com/rs/zerolog/log"
@@ -32,9 +33,9 @@ func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, identifier
"enable": true,
"data": identifier[0],
})
dExt.WebDriver.SwipeFloat(fromX, fromY, toX, toY, option)
dExt.Driver.SwipeFloat(fromX, fromY, toX, toY, option)
}
return dExt.WebDriver.SwipeFloat(fromX, fromY, toX, toY)
return dExt.Driver.SwipeFloat(fromX, fromY, toX, toY)
}
func (dExt *DriverExt) SwipeTo(direction string, identifier ...string) (err error) {
@@ -82,6 +83,8 @@ func (dExt *DriverExt) SwipeUntil(direction string, condition FindCondition, act
if err := dExt.SwipeTo(direction); err != nil {
log.Error().Err(err).Msgf("swipe %s failed", direction)
}
// wait for swipe done
time.Sleep(500 * time.Millisecond)
}
return fmt.Errorf("swipe %s %d times, match condition failed", direction, maxTimes)
}