File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
selenium/webdriver/chromium
test/selenium/webdriver/chrome Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,17 @@ def to_capabilities(self) -> dict:
163
163
"""
164
164
caps = self ._caps
165
165
chrome_options = self .experimental_options .copy ()
166
+ if 'w3c' in chrome_options :
167
+ if chrome_options ['w3c' ]:
168
+ warnings .warn (
169
+ "Setting 'w3c: True' is redundant and will no longer be allowed" ,
170
+ DeprecationWarning ,
171
+ stacklevel = 2
172
+ )
173
+ else :
174
+ raise AttributeError ('setting w3c to False is not allowed, '
175
+ 'Please update to W3C Syntax: '
176
+ 'https://www.selenium.dev/blog/2022/legacy-protocol-support/' )
166
177
if self .mobile_options :
167
178
chrome_options .update (self .mobile_options )
168
179
chrome_options ["extensions" ] = self .extensions
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from selenium import webdriver
4
+
5
+
6
+ def test_w3c_true ():
7
+ options = webdriver .ChromeOptions ()
8
+ options .add_experimental_option ("w3c" , True )
9
+
10
+ chrome_kwargs = {'options' : options }
11
+
12
+ with pytest .warns (DeprecationWarning , match = "Setting 'w3c: True' is redundant" ):
13
+ driver = webdriver .Chrome (** chrome_kwargs )
14
+
15
+ driver .quit ()
16
+
17
+
18
+ def test_w3c_false ():
19
+ options = webdriver .ChromeOptions ()
20
+ options .add_experimental_option ("w3c" , False )
21
+
22
+ chrome_kwargs = {'options' : options }
23
+
24
+ with pytest .raises (AttributeError ):
25
+ webdriver .Chrome (** chrome_kwargs )
You can’t perform that action at this time.
0 commit comments