Skip to content

Commit

Permalink
[py] remove deprecated headless methods
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 17, 2023
1 parent f116bac commit b5cfcc4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
36 changes: 0 additions & 36 deletions py/selenium/webdriver/chromium/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import base64
import os
import warnings
from typing import BinaryIO
from typing import List
from typing import Union
Expand Down Expand Up @@ -129,41 +128,6 @@ def add_experimental_option(self, name: str, value: Union[str, int, dict, List[s
"""
self._experimental_options[name] = value

@property
def headless(self) -> bool:
""":Returns: True if the headless argument is set, else False."""
warnings.warn(
"headless property is deprecated, instead check for '--headless' in arguments",
DeprecationWarning,
stacklevel=2,
)
return "--headless" in self._arguments

@headless.setter
def headless(self, value: bool) -> None:
"""Sets the headless argument Old headless uses a non-production
browser and is set with `--headless`
Native headless from v86 - v108 is set with `--headless=chrome`
Native headless from v109+ is set with `--headless=new`
:Args:
value: boolean value indicating to set the headless option
"""
warnings.warn(
"headless property is deprecated, instead use add_argument('--headless') or add_argument('--headless=new')",
DeprecationWarning,
stacklevel=2,
)
args = {"--headless"}

if not isinstance(value, bool):
raise TypeError("value must be a boolean")

if value:
self._arguments.extend(args)
else:
self._arguments = list(set(self._arguments) - args)

def to_capabilities(self) -> dict:
"""Creates a capabilities with all the options that have been set
:Returns: A dictionary with everything."""
Expand Down
27 changes: 0 additions & 27 deletions py/selenium/webdriver/firefox/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,6 @@ def profile(self, new_profile: Union[str, FirefoxProfile]) -> None:
new_profile = FirefoxProfile(new_profile)
self._profile = new_profile

@property
def headless(self) -> bool:
""":Returns: True if the headless argument is set, else False."""
warnings.warn(
"headless property is deprecated, instead check for '-headless' in arguments",
DeprecationWarning,
stacklevel=2,
)
return "-headless" in self._arguments

@headless.setter
def headless(self, value: bool) -> None:
"""Sets the headless argument.
Args:
value: boolean value indicating to set the headless option
"""
warnings.warn(
"headless property is deprecated, instead use add_argument('-headless')", DeprecationWarning, stacklevel=2
)
if not isinstance(value, bool):
raise TypeError("value must be a boolean")
if value:
self._arguments.append("-headless")
elif "-headless" in self._arguments:
self._arguments.remove("-headless")

def enable_mobile(self, android_package: str = "org.mozilla.firefox", android_activity=None, device_serial=None):
super().enable_mobile(android_package, android_activity, device_serial)

Expand Down

0 comments on commit b5cfcc4

Please sign in to comment.