Skip to content

Commit 4beab57

Browse files
authored
[py] Remove unsupported safari parameters from Options (#12454)
1 parent 521801e commit 4beab57

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

py/selenium/webdriver/safari/options.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -20,69 +20,13 @@
2020
from selenium.webdriver.common.options import ArgOptions
2121

2222

23-
class Log:
24-
def __init__(self) -> None:
25-
self.level = None
26-
27-
def to_capabilities(self) -> dict:
28-
if self.level:
29-
return {"log": {"level": self.level}}
30-
return {}
31-
32-
3323
class Options(ArgOptions):
34-
KEY = "safari.options"
35-
3624
# @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
3725
AUTOMATIC_INSPECTION = "safari:automaticInspection"
3826
AUTOMATIC_PROFILING = "safari:automaticProfiling"
3927

4028
SAFARI_TECH_PREVIEW = "Safari Technology Preview"
4129

42-
def __init__(self) -> None:
43-
super().__init__()
44-
self._binary_location = None
45-
self._preferences: dict = {}
46-
self.log = Log()
47-
48-
@property
49-
def binary_location(self) -> str:
50-
"""
51-
:Returns: The location of the browser binary otherwise an empty string
52-
"""
53-
return self._binary_location
54-
55-
@binary_location.setter
56-
def binary_location(self, value: str) -> None:
57-
"""Allows you to set the browser binary to launch.
58-
59-
:Args:
60-
- value : path to the browser binary
61-
"""
62-
if not isinstance(value, str):
63-
raise TypeError(self.BINARY_LOCATION_ERROR)
64-
self._binary_location = value
65-
66-
def to_capabilities(self) -> dict:
67-
"""Marshals the options to an desired capabilities object."""
68-
# This intentionally looks at the internal properties
69-
# so if a binary or profile has _not_ been set,
70-
# it will defer to geckodriver to find the system Firefox
71-
# and generate a fresh profile.
72-
caps = self._caps
73-
opts = {}
74-
75-
if self._arguments:
76-
opts["args"] = self._arguments
77-
if self._binary_location:
78-
opts["binary"] = self._binary_location
79-
opts.update(self.log.to_capabilities())
80-
81-
if opts:
82-
caps[Options.KEY] = opts
83-
84-
return caps
85-
8630
@property
8731
def default_capabilities(self) -> typing.Dict[str, str]:
8832
return DesiredCapabilities.SAFARI.copy()

py/test/unit/selenium/webdriver/safari/safari_options_tests.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,6 @@ def options():
2525
return Options()
2626

2727

28-
def test_set_binary_location(options):
29-
options.binary_location = "/foo/bar"
30-
assert options._binary_location == "/foo/bar"
31-
32-
33-
def test_get_binary_location(options):
34-
options._binary_location = "/foo/bar"
35-
assert options.binary_location == "/foo/bar"
36-
37-
38-
def test_creates_capabilities(options):
39-
options._arguments = ["foo"]
40-
options._binary_location = "/bar"
41-
caps = options.to_capabilities()
42-
opts = caps.get(Options.KEY)
43-
assert opts
44-
assert "foo" in opts["args"]
45-
assert opts["binary"] == "/bar"
46-
47-
4828
def test_starts_with_default_capabilities(options):
4929
from selenium.webdriver import DesiredCapabilities
5030

0 commit comments

Comments
 (0)