MCPcopy
hub / github.com/httprunner/httprunner / NewDriver

Method NewDriver

hrp/pkg/uixt/android_device.go:157–186  ·  view source on GitHub ↗
(options ...DriverOption)

Source from the content-addressed store, hash-verified

155}
156
157func (dev *AndroidDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error) {
158 driverOptions := &DriverOptions{}
159 for _, option := range options {
160 option(driverOptions)
161 }
162
163 var driver WebDriver
164 if dev.UIA2 || dev.LogOn {
165 driver, err = dev.NewUSBDriver(driverOptions.capabilities)
166 } else {
167 driver, err = dev.NewAdbDriver()
168 }
169 if err != nil {
170 return nil, errors.Wrap(err, "failed to init UIA driver")
171 }
172
173 driverExt, err = newDriverExt(dev, driver, driverOptions.plugin)
174 if err != nil {
175 return nil, err
176 }
177
178 if dev.LogOn {
179 err = driverExt.Driver.StartCaptureLog("hrp_adb_log")
180 if err != nil {
181 return nil, err
182 }
183 }
184
185 return driverExt, nil
186}
187
188// NewUSBDriver creates new client via USB connected device, this will also start a new session.
189func (dev *AndroidDevice) NewUSBDriver(capabilities Capabilities) (driver WebDriver, err error) {

Callers 6

parseConfigMethod · 0.95
TestTapUIWithScreenshotFunction · 0.95
setupAndroidFunction · 0.95
TestDriver_AppLaunchFunction · 0.95
TestDriver_KeepAliveFunction · 0.95
TestDriver_AppTerminateFunction · 0.95

Calls 4

NewUSBDriverMethod · 0.95
NewAdbDriverMethod · 0.95
newDriverExtFunction · 0.85
StartCaptureLogMethod · 0.65

Tested by 5

TestTapUIWithScreenshotFunction · 0.76
setupAndroidFunction · 0.76
TestDriver_AppLaunchFunction · 0.76
TestDriver_KeepAliveFunction · 0.76
TestDriver_AppTerminateFunction · 0.76