fix: 修复浏览器驱动的一些问题

This commit is contained in:
徐聪
2025-04-24 22:57:08 +08:00
parent 3c077bf555
commit 382aad2d9f
5 changed files with 86 additions and 24 deletions
+15
View File
@@ -11,6 +11,8 @@ func NewBrowserDeviceOptions(opts ...BrowserDeviceOption) *BrowserDeviceOptions
type BrowserDeviceOptions struct {
BrowserID string `json:"browser_id,omitempty" yaml:"browser_id,omitempty"`
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
Width int `json:"width,omitempty" yaml:"width,omitempty"`
Height int `json:"height,omitempty" yaml:"height,omitempty"`
}
type BrowserDeviceOption func(*BrowserDeviceOptions)
@@ -20,3 +22,16 @@ func WithBrowserID(serial string) BrowserDeviceOption {
device.BrowserID = serial
}
}
func WithBrowserLogOn(logOn bool) BrowserDeviceOption {
return func(device *BrowserDeviceOptions) {
device.LogOn = logOn
}
}
func WithBrowserPageSize(width, height int) BrowserDeviceOption {
return func(device *BrowserDeviceOptions) {
device.Width = width
device.Height = height
}
}