diff --git a/internal/version/VERSION b/internal/version/VERSION index 6dc6201d..3b61e780 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0+2503051147 +v5.0.0+2503051452 diff --git a/uixt/driver_ext_test.go b/uixt/driver_ext_test.go index 71b352e7..d625f11d 100644 --- a/uixt/driver_ext_test.go +++ b/uixt/driver_ext_test.go @@ -105,7 +105,7 @@ func TestDriverExt_Seek(t *testing.T) { err := driver.Swipe(0.5, 0.8, 0.5, 0.2) assert.Nil(t, err) time.Sleep(1 * time.Second) - err = driver.Drag(20, y, float64(width)*0.75, y) + err = driver.Swipe(20, y, float64(width)*0.6, y) assert.Nil(t, err) time.Sleep(1 * time.Second) } diff --git a/uixt/driver_session.go b/uixt/driver_session.go index 0bf5e80b..83d5e496 100644 --- a/uixt/driver_session.go +++ b/uixt/driver_session.go @@ -38,15 +38,11 @@ type DriverRequests struct { Error string `json:"error,omitempty"` } -const ( - emptySessionID = "" -) - func NewDriverSession() *DriverSession { timeout := 30 * time.Second session := &DriverSession{ ctx: context.Background(), - ID: emptySessionID, + ID: "", timeout: timeout, client: &http.Client{ Timeout: timeout, @@ -101,8 +97,11 @@ func (s *DriverSession) concatURL(urlStr string) (string, error) { } // replace with session ID - if s.ID != emptySessionID { - urlStr = strings.Replace(urlStr, emptySessionID, s.ID, 1) + if s.ID != "" && !strings.Contains(urlStr, s.ID) { + sessionPattern := regexp.MustCompile(`/session/([^/]+)/`) + if matches := sessionPattern.FindStringSubmatch(urlStr); len(matches) != 0 { + urlStr = strings.Replace(urlStr, matches[1], s.ID, 1) + } } // 处理完整 URL