Skip to content

Commit

Permalink
[py] add warning if people set w3c to false as it may break their tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Nov 22, 2021
1 parent 24a9c50 commit 5fd073d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions py/selenium/webdriver/chromium/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import base64
import os
import warnings
from typing import List, NoReturn, Union

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
Expand Down Expand Up @@ -129,6 +130,8 @@ def add_experimental_option(self, name: str, value: Union[str, int, dict, List[s
name: The experimental option name.
value: The option value.
"""
if name.lower() == "w3c" and (value == "false" or value == False):
warnings.warn(UserWarning("Manipulating `w3c` setting can have unintended consequences."))
self._experimental_options[name] = value

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,8 @@ def test_enables_chrome_mobile(options):
options.enable_mobile()
result_caps = options.to_capabilities()
assert result_caps["goog:chromeOptions"]["androidPackage"] == "com.android.chrome"


def test_set_w3c_false(options):
with pytest.warns(UserWarning):
options.add_experimental_option("w3c", False)

0 comments on commit 5fd073d

Please sign in to comment.