Skip to content

Commit b5cfcc4

Browse files
committed
[py] remove deprecated headless methods
1 parent f116bac commit b5cfcc4

File tree

2 files changed

+0
-63
lines changed

2 files changed

+0
-63
lines changed

py/selenium/webdriver/chromium/options.py

-36
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import base64
1919
import os
20-
import warnings
2120
from typing import BinaryIO
2221
from typing import List
2322
from typing import Union
@@ -129,41 +128,6 @@ def add_experimental_option(self, name: str, value: Union[str, int, dict, List[s
129128
"""
130129
self._experimental_options[name] = value
131130

132-
@property
133-
def headless(self) -> bool:
134-
""":Returns: True if the headless argument is set, else False."""
135-
warnings.warn(
136-
"headless property is deprecated, instead check for '--headless' in arguments",
137-
DeprecationWarning,
138-
stacklevel=2,
139-
)
140-
return "--headless" in self._arguments
141-
142-
@headless.setter
143-
def headless(self, value: bool) -> None:
144-
"""Sets the headless argument Old headless uses a non-production
145-
browser and is set with `--headless`
146-
147-
Native headless from v86 - v108 is set with `--headless=chrome`
148-
Native headless from v109+ is set with `--headless=new`
149-
:Args:
150-
value: boolean value indicating to set the headless option
151-
"""
152-
warnings.warn(
153-
"headless property is deprecated, instead use add_argument('--headless') or add_argument('--headless=new')",
154-
DeprecationWarning,
155-
stacklevel=2,
156-
)
157-
args = {"--headless"}
158-
159-
if not isinstance(value, bool):
160-
raise TypeError("value must be a boolean")
161-
162-
if value:
163-
self._arguments.extend(args)
164-
else:
165-
self._arguments = list(set(self._arguments) - args)
166-
167131
def to_capabilities(self) -> dict:
168132
"""Creates a capabilities with all the options that have been set
169133
:Returns: A dictionary with everything."""

py/selenium/webdriver/firefox/options.py

-27
Original file line numberDiff line numberDiff line change
@@ -98,33 +98,6 @@ def profile(self, new_profile: Union[str, FirefoxProfile]) -> None:
9898
new_profile = FirefoxProfile(new_profile)
9999
self._profile = new_profile
100100

101-
@property
102-
def headless(self) -> bool:
103-
""":Returns: True if the headless argument is set, else False."""
104-
warnings.warn(
105-
"headless property is deprecated, instead check for '-headless' in arguments",
106-
DeprecationWarning,
107-
stacklevel=2,
108-
)
109-
return "-headless" in self._arguments
110-
111-
@headless.setter
112-
def headless(self, value: bool) -> None:
113-
"""Sets the headless argument.
114-
115-
Args:
116-
value: boolean value indicating to set the headless option
117-
"""
118-
warnings.warn(
119-
"headless property is deprecated, instead use add_argument('-headless')", DeprecationWarning, stacklevel=2
120-
)
121-
if not isinstance(value, bool):
122-
raise TypeError("value must be a boolean")
123-
if value:
124-
self._arguments.append("-headless")
125-
elif "-headless" in self._arguments:
126-
self._arguments.remove("-headless")
127-
128101
def enable_mobile(self, android_package: str = "org.mozilla.firefox", android_activity=None, device_serial=None):
129102
super().enable_mobile(android_package, android_activity, device_serial)
130103

0 commit comments

Comments
 (0)