mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
change: NewBrowserDeviceOptions
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2503032203
|
v5.0.0+2503041034
|
||||||
|
|||||||
@@ -15,11 +15,7 @@ type BrowserDevice struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewBrowserDevice(opts ...option.BrowserDeviceOption) (device *BrowserDevice, err error) {
|
func NewBrowserDevice(opts ...option.BrowserDeviceOption) (device *BrowserDevice, err error) {
|
||||||
options := &option.BrowserDeviceOptions{}
|
options := option.NewBrowserDeviceOptions(opts...)
|
||||||
for _, option := range opts {
|
|
||||||
option(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
if options.BrowserID == "" {
|
if options.BrowserID == "" {
|
||||||
browserInfo, err := CreateBrowser(3600)
|
browserInfo, err := CreateBrowser(3600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
package option
|
package option
|
||||||
|
|
||||||
|
func NewBrowserDeviceOptions(opts ...BrowserDeviceOption) *BrowserDeviceOptions {
|
||||||
|
config := &BrowserDeviceOptions{}
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(config)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
|
||||||
type BrowserDeviceOptions struct {
|
type BrowserDeviceOptions struct {
|
||||||
BrowserID string `json:"browser_id,omitempty" yaml:"browser_id,omitempty"`
|
BrowserID string `json:"browser_id,omitempty" yaml:"browser_id,omitempty"`
|
||||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user