File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ class Builder {
318
318
}
319
319
320
320
/**
321
- * @deprecated Since Selenium 4.0 withCapabilities is deprecated, use set*Options instead where * is the browser(eg setChromeOptions)
321
+ * Recommended way is to use set*Options where * is the browser(eg setChromeOptions)
322
322
*
323
323
* Sets the desired capabilities when requesting a new session. This will
324
324
* overwrite any previously set capabilities.
Original file line number Diff line number Diff line change @@ -69,3 +69,30 @@ test.suite(function (env) {
69
69
} )
70
70
}
71
71
} )
72
+
73
+ describe ( 'Builder' , function ( ) {
74
+ describe ( 'catches incorrect use of browser options class' , function ( ) {
75
+ function test ( key , options ) {
76
+ it ( key , async function ( ) {
77
+ let builder = new Builder ( ) . withCapabilities (
78
+ new Capabilities ( )
79
+ . set ( 'browserName' , 'fake-browser-should-not-try-to-start' )
80
+ . set ( key , new options ( ) )
81
+ )
82
+ try {
83
+ let driver = await builder . build ( )
84
+ await driver . quit ( )
85
+ return Promise . reject ( Error ( 'should have failed' ) )
86
+ } catch ( ex ) {
87
+ if ( ! ( ex instanceof error . InvalidArgumentError ) ) {
88
+ throw ex
89
+ }
90
+ }
91
+ } )
92
+ }
93
+
94
+ test ( 'chromeOptions' , chrome . Options )
95
+ test ( 'moz:firefoxOptions' , firefox . Options )
96
+ test ( 'safari.options' , safari . Options )
97
+ } )
98
+ } )
You can’t perform that action at this time.
0 commit comments