refactor: BrowserDevice & BrowserDriver

This commit is contained in:
lilong.129
2025-03-03 22:03:42 +08:00
parent b687abb3c8
commit b69f5d5b25
7 changed files with 103 additions and 121 deletions

View File

@@ -1,9 +1,10 @@
package server_ext
import (
"github.com/gin-gonic/gin"
"strings"
"github.com/gin-gonic/gin"
"github.com/httprunner/httprunner/v5/pkg/uixt"
"github.com/httprunner/httprunner/v5/pkg/uixt/ai"
"github.com/httprunner/httprunner/v5/pkg/uixt/driver_ext"
@@ -12,7 +13,6 @@ import (
func (p RouterBaseMethodExt) GetDriver(c *gin.Context) (driverExt uixt.IXTDriver, err error) {
platform := c.Param("platform")
serial := c.Param("serial")
deviceObj, exists := c.Get("device")
var device uixt.IDevice
var driver driver_ext.IStubDriver
@@ -30,7 +30,7 @@ func (p RouterBaseMethodExt) GetDriver(c *gin.Context) (driverExt uixt.IXTDriver
case "ios":
driver, err = driver_ext.NewStubIOSDriver(device.(*uixt.IOSDevice))
case "browser":
driver, err = driver_ext.NewStubBrowserDriver(serial)
driver, err = driver_ext.NewStubBrowserDriver(device.(*uixt.BrowserDevice))
}
if err != nil {
server.RenderErrorInitDriver(c, err)