selenium-webdriver 4.16.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +253 -196
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/bidi/addInterceptParameters.js +86 -0
- package/bidi/browsingContext.js +167 -38
- package/bidi/browsingContextInspector.js +13 -40
- package/bidi/evaluateResult.js +4 -10
- package/bidi/filterBy.js +2 -6
- package/bidi/index.js +31 -29
- package/bidi/input.js +97 -0
- package/bidi/interceptPhase.js +24 -0
- package/bidi/logInspector.js +15 -20
- package/bidi/network.js +178 -0
- package/bidi/networkInspector.js +12 -2
- package/bidi/networkTypes.js +22 -49
- package/bidi/protocolType.js +4 -9
- package/bidi/protocolValue.js +48 -17
- package/bidi/realmInfo.js +3 -10
- package/bidi/scriptManager.js +60 -48
- package/bidi/scriptTypes.js +58 -0
- package/bidi/urlPattern.js +58 -0
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/chrome.js +2 -14
- package/chromium.js +28 -143
- package/common/driverFinder.js +1 -1
- package/common/seleniumManager.js +5 -12
- package/devtools/CDPConnection.js +1 -3
- package/edge.js +1 -3
- package/example/chrome_android.js +2 -5
- package/example/chrome_mobile_emulation.js +2 -4
- package/example/google_search.js +1 -3
- package/example/headless.js +4 -10
- package/example/logging.js +3 -9
- package/firefox.js +37 -111
- package/http/index.js +7 -10
- package/ie.js +5 -15
- package/index.js +10 -32
- package/io/exec.js +1 -2
- package/io/index.js +3 -3
- package/io/zip.js +8 -30
- package/lib/atoms/find-elements.js +1 -1
- package/lib/atoms/get-attribute.js +6 -100
- package/lib/by.js +2 -9
- package/lib/capabilities.js +8 -7
- package/lib/command.js +4 -0
- package/lib/error.js +2 -9
- package/lib/http.js +37 -130
- package/lib/input.js +22 -34
- package/lib/logging.js +3 -11
- package/lib/promise.js +2 -7
- package/lib/select.js +3 -9
- package/lib/until.js +28 -49
- package/lib/util.js +1 -4
- package/lib/virtual_authenticator.js +4 -22
- package/lib/webdriver.js +146 -269
- package/lib/webelement.js +1 -5
- package/net/index.js +1 -4
- package/package.json +2 -1
- package/remote/index.js +9 -24
- package/remote/util.js +6 -19
- package/safari.js +3 -8
- package/testing/index.js +6 -11
- package/example/firefox_channels.js +0 -84
package/chromium.js
CHANGED
|
@@ -36,17 +36,12 @@
|
|
|
36
36
|
* a unique browser session with a clean user profile (unless otherwise
|
|
37
37
|
* configured through the {@link Options} class).
|
|
38
38
|
*
|
|
39
|
-
* __Headless Chromium__ <a id="headless"></a>
|
|
40
|
-
*
|
|
41
|
-
* To start the browser in headless mode, simply call
|
|
42
|
-
* {@linkplain Options#headless Options.headless()}.
|
|
43
|
-
*
|
|
44
39
|
* let chrome = require('selenium-webdriver/chrome');
|
|
45
40
|
* let {Builder} = require('selenium-webdriver');
|
|
46
41
|
*
|
|
47
42
|
* let driver = new Builder()
|
|
48
43
|
* .forBrowser('chrome')
|
|
49
|
-
* .setChromeOptions(new chrome.Options()
|
|
44
|
+
* .setChromeOptions(new chrome.Options())
|
|
50
45
|
* .build();
|
|
51
46
|
*
|
|
52
47
|
* __Customizing the Chromium WebDriver Server__ <a id="custom-server"></a>
|
|
@@ -124,71 +119,39 @@ function createExecutor(url, vendorPrefix) {
|
|
|
124
119
|
* @param {!http.Executor} executor the executor to configure.
|
|
125
120
|
*/
|
|
126
121
|
function configureExecutor(executor, vendorPrefix) {
|
|
127
|
-
executor.defineCommand(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
)
|
|
132
|
-
executor.defineCommand(
|
|
133
|
-
Command.GET_NETWORK_CONDITIONS,
|
|
134
|
-
'GET',
|
|
135
|
-
'/session/:sessionId/chromium/network_conditions'
|
|
136
|
-
)
|
|
137
|
-
executor.defineCommand(
|
|
138
|
-
Command.SET_NETWORK_CONDITIONS,
|
|
139
|
-
'POST',
|
|
140
|
-
'/session/:sessionId/chromium/network_conditions'
|
|
141
|
-
)
|
|
142
|
-
executor.defineCommand(
|
|
143
|
-
Command.DELETE_NETWORK_CONDITIONS,
|
|
144
|
-
'DELETE',
|
|
145
|
-
'/session/:sessionId/chromium/network_conditions'
|
|
146
|
-
)
|
|
147
|
-
executor.defineCommand(
|
|
148
|
-
Command.SEND_DEVTOOLS_COMMAND,
|
|
149
|
-
'POST',
|
|
150
|
-
'/session/:sessionId/chromium/send_command'
|
|
151
|
-
)
|
|
122
|
+
executor.defineCommand(Command.LAUNCH_APP, 'POST', '/session/:sessionId/chromium/launch_app')
|
|
123
|
+
executor.defineCommand(Command.GET_NETWORK_CONDITIONS, 'GET', '/session/:sessionId/chromium/network_conditions')
|
|
124
|
+
executor.defineCommand(Command.SET_NETWORK_CONDITIONS, 'POST', '/session/:sessionId/chromium/network_conditions')
|
|
125
|
+
executor.defineCommand(Command.DELETE_NETWORK_CONDITIONS, 'DELETE', '/session/:sessionId/chromium/network_conditions')
|
|
126
|
+
executor.defineCommand(Command.SEND_DEVTOOLS_COMMAND, 'POST', '/session/:sessionId/chromium/send_command')
|
|
152
127
|
executor.defineCommand(
|
|
153
128
|
Command.SEND_AND_GET_DEVTOOLS_COMMAND,
|
|
154
129
|
'POST',
|
|
155
|
-
'/session/:sessionId/chromium/send_command_and_get_result'
|
|
156
|
-
)
|
|
157
|
-
executor.defineCommand(
|
|
158
|
-
Command.SET_PERMISSION,
|
|
159
|
-
'POST',
|
|
160
|
-
'/session/:sessionId/permissions'
|
|
161
|
-
)
|
|
162
|
-
executor.defineCommand(
|
|
163
|
-
Command.GET_CAST_SINKS,
|
|
164
|
-
'GET',
|
|
165
|
-
`/session/:sessionId/${vendorPrefix}/cast/get_sinks`
|
|
130
|
+
'/session/:sessionId/chromium/send_command_and_get_result',
|
|
166
131
|
)
|
|
132
|
+
executor.defineCommand(Command.SET_PERMISSION, 'POST', '/session/:sessionId/permissions')
|
|
133
|
+
executor.defineCommand(Command.GET_CAST_SINKS, 'GET', `/session/:sessionId/${vendorPrefix}/cast/get_sinks`)
|
|
167
134
|
executor.defineCommand(
|
|
168
135
|
Command.SET_CAST_SINK_TO_USE,
|
|
169
136
|
'POST',
|
|
170
|
-
`/session/:sessionId/${vendorPrefix}/cast/set_sink_to_use
|
|
137
|
+
`/session/:sessionId/${vendorPrefix}/cast/set_sink_to_use`,
|
|
171
138
|
)
|
|
172
139
|
executor.defineCommand(
|
|
173
140
|
Command.START_CAST_DESKTOP_MIRRORING,
|
|
174
141
|
'POST',
|
|
175
|
-
`/session/:sessionId/${vendorPrefix}/cast/start_desktop_mirroring
|
|
142
|
+
`/session/:sessionId/${vendorPrefix}/cast/start_desktop_mirroring`,
|
|
176
143
|
)
|
|
177
144
|
executor.defineCommand(
|
|
178
145
|
Command.START_CAST_TAB_MIRRORING,
|
|
179
146
|
'POST',
|
|
180
|
-
`/session/:sessionId/${vendorPrefix}/cast/start_tab_mirroring
|
|
147
|
+
`/session/:sessionId/${vendorPrefix}/cast/start_tab_mirroring`,
|
|
181
148
|
)
|
|
182
149
|
executor.defineCommand(
|
|
183
150
|
Command.GET_CAST_ISSUE_MESSAGE,
|
|
184
151
|
'GET',
|
|
185
|
-
`/session/:sessionId/${vendorPrefix}/cast/get_issue_message
|
|
186
|
-
)
|
|
187
|
-
executor.defineCommand(
|
|
188
|
-
Command.STOP_CASTING,
|
|
189
|
-
'POST',
|
|
190
|
-
`/session/:sessionId/${vendorPrefix}/cast/stop_casting`
|
|
152
|
+
`/session/:sessionId/${vendorPrefix}/cast/get_issue_message`,
|
|
191
153
|
)
|
|
154
|
+
executor.defineCommand(Command.STOP_CASTING, 'POST', `/session/:sessionId/${vendorPrefix}/cast/stop_casting`)
|
|
192
155
|
}
|
|
193
156
|
|
|
194
157
|
/**
|
|
@@ -310,34 +273,6 @@ class Options extends Capabilities {
|
|
|
310
273
|
return this
|
|
311
274
|
}
|
|
312
275
|
|
|
313
|
-
/**
|
|
314
|
-
* @deprecated Use {@link Options#addArguments} instead.
|
|
315
|
-
* @example
|
|
316
|
-
* options.addArguments('--headless=chrome'); (or)
|
|
317
|
-
* options.addArguments('--headless');
|
|
318
|
-
* @example
|
|
319
|
-
*
|
|
320
|
-
* Recommended to use '--headless=chrome' as argument for browsers v94-108.
|
|
321
|
-
* Recommended to use '--headless=new' as argument for browsers v109+.
|
|
322
|
-
*
|
|
323
|
-
* Configures the driver to start the browser in headless mode.
|
|
324
|
-
*
|
|
325
|
-
* > __NOTE:__ Resizing the browser window in headless mode is only supported
|
|
326
|
-
* > in Chromium 60+. Users are encouraged to set an initial window size with
|
|
327
|
-
* > the {@link #windowSize windowSize({width, height})} option.
|
|
328
|
-
*
|
|
329
|
-
* > __NOTE__: For security, Chromium disables downloads by default when
|
|
330
|
-
* > in headless mode (to prevent sites from silently downloading files to
|
|
331
|
-
* > your machine). After creating a session, you may call
|
|
332
|
-
* > {@link ./chrome.Driver#setDownloadPath setDownloadPath} to re-enable
|
|
333
|
-
* > downloads, saving files in the specified directory.
|
|
334
|
-
*
|
|
335
|
-
* @return {!Options} A self reference.
|
|
336
|
-
*/
|
|
337
|
-
headless() {
|
|
338
|
-
return this.addArguments('headless')
|
|
339
|
-
}
|
|
340
|
-
|
|
341
276
|
/**
|
|
342
277
|
* Sets the initial window size.
|
|
343
278
|
*
|
|
@@ -655,9 +590,7 @@ class Extensions {
|
|
|
655
590
|
if (Buffer.isBuffer(extension)) {
|
|
656
591
|
return extension.toString('base64')
|
|
657
592
|
}
|
|
658
|
-
return io
|
|
659
|
-
.read(/** @type {string} */ (extension))
|
|
660
|
-
.then((buffer) => buffer.toString('base64'))
|
|
593
|
+
return io.read(/** @type {string} */ (extension)).then((buffer) => buffer.toString('base64'))
|
|
661
594
|
})
|
|
662
595
|
}
|
|
663
596
|
}
|
|
@@ -679,12 +612,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
679
612
|
* @param vendorCapabilityKey Either 'goog:chromeOptions' or 'ms:edgeOptions'
|
|
680
613
|
* @return {!Driver} A new driver instance.
|
|
681
614
|
*/
|
|
682
|
-
static createSession(
|
|
683
|
-
caps,
|
|
684
|
-
opt_serviceExecutor,
|
|
685
|
-
vendorPrefix = '',
|
|
686
|
-
vendorCapabilityKey = ''
|
|
687
|
-
) {
|
|
615
|
+
static createSession(caps, opt_serviceExecutor, vendorPrefix = '', vendorCapabilityKey = '') {
|
|
688
616
|
let executor
|
|
689
617
|
let onQuit
|
|
690
618
|
if (opt_serviceExecutor instanceof http.Executor) {
|
|
@@ -734,9 +662,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
734
662
|
* when app is launched.
|
|
735
663
|
*/
|
|
736
664
|
launchApp(id) {
|
|
737
|
-
return this.execute(
|
|
738
|
-
new command.Command(Command.LAUNCH_APP).setParameter('id', id)
|
|
739
|
-
)
|
|
665
|
+
return this.execute(new command.Command(Command.LAUNCH_APP).setParameter('id', id))
|
|
740
666
|
}
|
|
741
667
|
|
|
742
668
|
/**
|
|
@@ -775,16 +701,9 @@ class Driver extends webdriver.WebDriver {
|
|
|
775
701
|
*/
|
|
776
702
|
setNetworkConditions(spec) {
|
|
777
703
|
if (!spec || typeof spec !== 'object') {
|
|
778
|
-
throw TypeError(
|
|
779
|
-
'setNetworkConditions called with non-network-conditions parameter'
|
|
780
|
-
)
|
|
704
|
+
throw TypeError('setNetworkConditions called with non-network-conditions parameter')
|
|
781
705
|
}
|
|
782
|
-
return this.execute(
|
|
783
|
-
new command.Command(Command.SET_NETWORK_CONDITIONS).setParameter(
|
|
784
|
-
'network_conditions',
|
|
785
|
-
spec
|
|
786
|
-
)
|
|
787
|
-
)
|
|
706
|
+
return this.execute(new command.Command(Command.SET_NETWORK_CONDITIONS).setParameter('network_conditions', spec))
|
|
788
707
|
}
|
|
789
708
|
|
|
790
709
|
/**
|
|
@@ -798,9 +717,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
798
717
|
*/
|
|
799
718
|
sendDevToolsCommand(cmd, params = {}) {
|
|
800
719
|
return this.execute(
|
|
801
|
-
new command.Command(Command.SEND_DEVTOOLS_COMMAND)
|
|
802
|
-
.setParameter('cmd', cmd)
|
|
803
|
-
.setParameter('params', params)
|
|
720
|
+
new command.Command(Command.SEND_DEVTOOLS_COMMAND).setParameter('cmd', cmd).setParameter('params', params),
|
|
804
721
|
)
|
|
805
722
|
}
|
|
806
723
|
|
|
@@ -817,7 +734,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
817
734
|
return this.execute(
|
|
818
735
|
new command.Command(Command.SEND_AND_GET_DEVTOOLS_COMMAND)
|
|
819
736
|
.setParameter('cmd', cmd)
|
|
820
|
-
.setParameter('params', params)
|
|
737
|
+
.setParameter('params', params),
|
|
821
738
|
)
|
|
822
739
|
}
|
|
823
740
|
|
|
@@ -833,9 +750,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
833
750
|
*/
|
|
834
751
|
setPermission(name, state) {
|
|
835
752
|
return this.execute(
|
|
836
|
-
new command.Command(Command.SET_PERMISSION)
|
|
837
|
-
.setParameter('descriptor', { name })
|
|
838
|
-
.setParameter('state', state)
|
|
753
|
+
new command.Command(Command.SET_PERMISSION).setParameter('descriptor', { name }).setParameter('state', state),
|
|
839
754
|
)
|
|
840
755
|
}
|
|
841
756
|
|
|
@@ -868,10 +783,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
868
783
|
* containing the friendly device names of available cast sink targets.
|
|
869
784
|
*/
|
|
870
785
|
getCastSinks() {
|
|
871
|
-
return this.
|
|
872
|
-
new command.Command(Command.GET_CAST_SINKS),
|
|
873
|
-
'Driver.getCastSinks()'
|
|
874
|
-
)
|
|
786
|
+
return this.execute(new command.Command(Command.GET_CAST_SINKS))
|
|
875
787
|
}
|
|
876
788
|
|
|
877
789
|
/**
|
|
@@ -882,13 +794,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
882
794
|
* when the target device has been selected to respond further webdriver commands.
|
|
883
795
|
*/
|
|
884
796
|
setCastSinkToUse(deviceName) {
|
|
885
|
-
return this.
|
|
886
|
-
new command.Command(Command.SET_CAST_SINK_TO_USE).setParameter(
|
|
887
|
-
'sinkName',
|
|
888
|
-
deviceName
|
|
889
|
-
),
|
|
890
|
-
'Driver.setCastSinkToUse(' + deviceName + ')'
|
|
891
|
-
)
|
|
797
|
+
return this.execute(new command.Command(Command.SET_CAST_SINK_TO_USE).setParameter('sinkName', deviceName))
|
|
892
798
|
}
|
|
893
799
|
|
|
894
800
|
/**
|
|
@@ -899,13 +805,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
899
805
|
* when the mirror command has been issued to the device.
|
|
900
806
|
*/
|
|
901
807
|
startDesktopMirroring(deviceName) {
|
|
902
|
-
return this.
|
|
903
|
-
new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter(
|
|
904
|
-
'sinkName',
|
|
905
|
-
deviceName
|
|
906
|
-
),
|
|
907
|
-
'Driver.startDesktopMirroring(' + deviceName + ')'
|
|
908
|
-
)
|
|
808
|
+
return this.execute(new command.Command(Command.START_CAST_DESKTOP_MIRRORING).setParameter('sinkName', deviceName))
|
|
909
809
|
}
|
|
910
810
|
|
|
911
811
|
/**
|
|
@@ -916,13 +816,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
916
816
|
* when the mirror command has been issued to the device.
|
|
917
817
|
*/
|
|
918
818
|
startCastTabMirroring(deviceName) {
|
|
919
|
-
return this.
|
|
920
|
-
new command.Command(Command.START_CAST_TAB_MIRRORING).setParameter(
|
|
921
|
-
'sinkName',
|
|
922
|
-
deviceName
|
|
923
|
-
),
|
|
924
|
-
'Driver.startCastTabMirroring(' + deviceName + ')'
|
|
925
|
-
)
|
|
819
|
+
return this.execute(new command.Command(Command.START_CAST_TAB_MIRRORING).setParameter('sinkName', deviceName))
|
|
926
820
|
}
|
|
927
821
|
|
|
928
822
|
/**
|
|
@@ -931,10 +825,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
931
825
|
* when the mirror command has been issued to the device.
|
|
932
826
|
*/
|
|
933
827
|
getCastIssueMessage() {
|
|
934
|
-
return this.
|
|
935
|
-
new command.Command(Command.GET_CAST_ISSUE_MESSAGE),
|
|
936
|
-
'Driver.getCastIssueMessage()'
|
|
937
|
-
)
|
|
828
|
+
return this.execute(new command.Command(Command.GET_CAST_ISSUE_MESSAGE))
|
|
938
829
|
}
|
|
939
830
|
|
|
940
831
|
/**
|
|
@@ -945,13 +836,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
945
836
|
* when the stop command has been issued to the device.
|
|
946
837
|
*/
|
|
947
838
|
stopCasting(deviceName) {
|
|
948
|
-
return this.
|
|
949
|
-
new command.Command(Command.STOP_CASTING).setParameter(
|
|
950
|
-
'sinkName',
|
|
951
|
-
deviceName
|
|
952
|
-
),
|
|
953
|
-
'Driver.stopCasting(' + deviceName + ')'
|
|
954
|
-
)
|
|
839
|
+
return this.execute(new command.Command(Command.STOP_CASTING).setParameter('sinkName', deviceName))
|
|
955
840
|
}
|
|
956
841
|
}
|
|
957
842
|
|
package/common/driverFinder.js
CHANGED
|
@@ -35,7 +35,7 @@ function getPath(capabilities) {
|
|
|
35
35
|
throw Error(
|
|
36
36
|
`Unable to obtain browser driver.
|
|
37
37
|
For more information on how to install drivers see
|
|
38
|
-
https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. ${e}
|
|
38
|
+
https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. ${e}`,
|
|
39
39
|
)
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -43,8 +43,7 @@ function getBinary() {
|
|
|
43
43
|
linux: 'linux',
|
|
44
44
|
}[platform]
|
|
45
45
|
|
|
46
|
-
const file =
|
|
47
|
-
directory === 'windows' ? 'selenium-manager.exe' : 'selenium-manager'
|
|
46
|
+
const file = directory === 'windows' ? 'selenium-manager.exe' : 'selenium-manager'
|
|
48
47
|
|
|
49
48
|
let seleniumManagerBasePath = path.join(__dirname, '..', '/bin')
|
|
50
49
|
|
|
@@ -70,16 +69,14 @@ function getBinary() {
|
|
|
70
69
|
*/
|
|
71
70
|
|
|
72
71
|
function driverLocation(options) {
|
|
73
|
-
let args = ['--browser', options.getBrowserName(), '--output', 'json']
|
|
72
|
+
let args = ['--browser', options.getBrowserName(), '--language-binding', 'javascript', '--output', 'json']
|
|
74
73
|
|
|
75
74
|
if (options.getBrowserVersion() && options.getBrowserVersion() !== '') {
|
|
76
75
|
args.push('--browser-version', options.getBrowserVersion())
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
const vendorOptions =
|
|
80
|
-
options.get('goog:chromeOptions') ||
|
|
81
|
-
options.get('ms:edgeOptions') ||
|
|
82
|
-
options.get('moz:firefoxOptions')
|
|
79
|
+
options.get('goog:chromeOptions') || options.get('ms:edgeOptions') || options.get('moz:firefoxOptions')
|
|
83
80
|
if (vendorOptions && vendorOptions.binary && vendorOptions.binary !== '') {
|
|
84
81
|
args.push('--browser-path', path.resolve(vendorOptions.binary))
|
|
85
82
|
}
|
|
@@ -115,16 +112,12 @@ function driverLocation(options) {
|
|
|
115
112
|
errorMessage = e.toString()
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
|
-
throw new Error(
|
|
119
|
-
`Error executing command for ${smBinary} with ${args}: ${errorMessage}`
|
|
120
|
-
)
|
|
115
|
+
throw new Error(`Error executing command for ${smBinary} with ${args}: ${errorMessage}`)
|
|
121
116
|
}
|
|
122
117
|
try {
|
|
123
118
|
output = JSON.parse(spawnResult.stdout.toString())
|
|
124
119
|
} catch (e) {
|
|
125
|
-
throw new Error(
|
|
126
|
-
`Error executing command for ${smBinary} with ${args}: ${e.toString()}`
|
|
127
|
-
)
|
|
120
|
+
throw new Error(`Error executing command for ${smBinary} with ${args}: ${e.toString()}`)
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
// Once driverPath is available, delete browserVersion from payload
|
|
@@ -67,9 +67,7 @@ class CDPConnection {
|
|
|
67
67
|
resolve(payload)
|
|
68
68
|
}
|
|
69
69
|
} catch (err) {
|
|
70
|
-
logging
|
|
71
|
-
.getLogger(logging.Type.BROWSER)
|
|
72
|
-
.severe(`Failed parse message: ${err.message}`)
|
|
70
|
+
logging.getLogger(logging.Type.BROWSER).severe(`Failed parse message: ${err.message}`)
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
73
|
|
package/edge.js
CHANGED
|
@@ -147,9 +147,7 @@ class Driver extends chromium.Driver {
|
|
|
147
147
|
*/
|
|
148
148
|
static createSession(opt_config, opt_serviceExecutor) {
|
|
149
149
|
let caps = opt_config || new Options()
|
|
150
|
-
return /** @type {!Driver} */ (
|
|
151
|
-
super.createSession(caps, opt_serviceExecutor, 'ms', EDGE_CAPABILITY_KEY)
|
|
152
|
-
)
|
|
150
|
+
return /** @type {!Driver} */ (super.createSession(caps, opt_serviceExecutor, 'ms', EDGE_CAPABILITY_KEY))
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
/**
|
|
@@ -29,10 +29,7 @@ const { Options } = require('../chrome')
|
|
|
29
29
|
;(async function () {
|
|
30
30
|
let driver
|
|
31
31
|
try {
|
|
32
|
-
driver = await new Builder()
|
|
33
|
-
.forBrowser('chrome')
|
|
34
|
-
.setChromeOptions(new Options().androidChrome())
|
|
35
|
-
.build()
|
|
32
|
+
driver = await new Builder().forBrowser('chrome').setChromeOptions(new Options().androidChrome()).build()
|
|
36
33
|
await driver.get('http://www.google.com/ncr')
|
|
37
34
|
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
38
35
|
await driver.wait(until.titleIs('webdriver - Google Search'), 1000)
|
|
@@ -41,5 +38,5 @@ const { Options } = require('../chrome')
|
|
|
41
38
|
}
|
|
42
39
|
})().then(
|
|
43
40
|
(_) => console.log('SUCCESS'),
|
|
44
|
-
(err) => console.error('ERROR: ' + err)
|
|
41
|
+
(err) => console.error('ERROR: ' + err),
|
|
45
42
|
)
|
|
@@ -30,9 +30,7 @@ const { Options } = require('../chrome')
|
|
|
30
30
|
try {
|
|
31
31
|
driver = await new Builder()
|
|
32
32
|
.forBrowser('chrome')
|
|
33
|
-
.setChromeOptions(
|
|
34
|
-
new Options().setMobileEmulation({ deviceName: 'Nexus 5X' })
|
|
35
|
-
)
|
|
33
|
+
.setChromeOptions(new Options().setMobileEmulation({ deviceName: 'Nexus 5X' }))
|
|
36
34
|
.build()
|
|
37
35
|
await driver.get('http://www.google.com/ncr')
|
|
38
36
|
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
@@ -42,5 +40,5 @@ const { Options } = require('../chrome')
|
|
|
42
40
|
}
|
|
43
41
|
})().then(
|
|
44
42
|
(_) => console.log('SUCCESS'),
|
|
45
|
-
(err) => console.error('ERROR: ' + err)
|
|
43
|
+
(err) => console.error('ERROR: ' + err),
|
|
46
44
|
)
|
package/example/google_search.js
CHANGED
|
@@ -43,8 +43,6 @@ const driver = new Builder().forBrowser('firefox').build()
|
|
|
43
43
|
|
|
44
44
|
driver
|
|
45
45
|
.get('http://www.google.com/ncr')
|
|
46
|
-
.then((_) =>
|
|
47
|
-
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
48
|
-
)
|
|
46
|
+
.then((_) => driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
49
47
|
.then((_) => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
50
48
|
.then((_) => driver.quit())
|
package/example/headless.js
CHANGED
|
@@ -40,24 +40,18 @@ const height = 480
|
|
|
40
40
|
|
|
41
41
|
let driver = new Builder()
|
|
42
42
|
.forBrowser('chrome')
|
|
43
|
-
.setChromeOptions(
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
.setFirefoxOptions(
|
|
47
|
-
new firefox.Options().headless().windowSize({ width, height })
|
|
48
|
-
)
|
|
43
|
+
.setChromeOptions(new chrome.Options().addArguments('-headless').windowSize({ width, height }))
|
|
44
|
+
.setFirefoxOptions(new firefox.Options().addArguments('-headless').windowSize({ width, height }))
|
|
49
45
|
.build()
|
|
50
46
|
|
|
51
47
|
driver
|
|
52
48
|
.get('http://www.google.com/ncr')
|
|
53
|
-
.then((_) =>
|
|
54
|
-
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
55
|
-
)
|
|
49
|
+
.then((_) => driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
56
50
|
.then((_) => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
57
51
|
.then(
|
|
58
52
|
(_) => driver.quit(),
|
|
59
53
|
(e) =>
|
|
60
54
|
driver.quit().then(() => {
|
|
61
55
|
throw e
|
|
62
|
-
})
|
|
56
|
+
}),
|
|
63
57
|
)
|
package/example/logging.js
CHANGED
|
@@ -40,17 +40,11 @@ logging.getLogger(`${logging.Type.DRIVER}.http`).setLevel(logging.Level.ALL)
|
|
|
40
40
|
// Configure the service for each browser to enable verbose logging and
|
|
41
41
|
// to inherit the stdio settings from the current process. The builder
|
|
42
42
|
// will only start the service if needed for the selected browser.
|
|
43
|
-
.setChromeService(
|
|
44
|
-
new chrome.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
45
|
-
)
|
|
43
|
+
.setChromeService(new chrome.ServiceBuilder().enableVerboseLogging().setStdio('inherit'))
|
|
46
44
|
.setEdgeService(
|
|
47
|
-
process.platform === 'win32'
|
|
48
|
-
? new edge.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
49
|
-
: null
|
|
50
|
-
)
|
|
51
|
-
.setFirefoxService(
|
|
52
|
-
new firefox.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
45
|
+
process.platform === 'win32' ? new edge.ServiceBuilder().enableVerboseLogging().setStdio('inherit') : null,
|
|
53
46
|
)
|
|
47
|
+
.setFirefoxService(new firefox.ServiceBuilder().enableVerboseLogging().setStdio('inherit'))
|
|
54
48
|
.build()
|
|
55
49
|
|
|
56
50
|
await driver.get('http://www.google.com/ncr')
|