Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Moving ignore_local_proxy_environment_variables to BaseOptions
  • Loading branch information
diemol committed May 10, 2024
commit 4623f3f5301328fad1146c0406fc9c4eb6492e26
19 changes: 17 additions & 2 deletions py/selenium/webdriver/common/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
# specific language governing permissions and limitations
# under the License.
import typing
import warnings
from abc import ABCMeta
from abc import abstractmethod
from enum import Enum

from typing_extensions import deprecated

from selenium.common.exceptions import InvalidArgumentException
from selenium.webdriver.common.proxy import Proxy

Expand Down Expand Up @@ -367,6 +370,7 @@ def __init__(self) -> None:
self._proxy = None
self.set_capability("pageLoadStrategy", PageLoadStrategy.normal)
self.mobile_options = None
self._ignore_local_proxy = False

@property
def capabilities(self):
Expand Down Expand Up @@ -404,14 +408,18 @@ def to_capabilities(self):
def default_capabilities(self):
"""Return minimal capabilities necessary as a dictionary."""

def ignore_local_proxy_environment_variables(self) -> None:
"""By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from
being picked up and used."""
self._ignore_local_proxy = True


class ArgOptions(BaseOptions):
BINARY_LOCATION_ERROR = "Binary Location Must be a String"

def __init__(self) -> None:
super().__init__()
self._arguments = []
self._ignore_local_proxy = False

@property
def arguments(self):
Expand All @@ -429,10 +437,17 @@ def add_argument(self, argument) -> None:
else:
raise ValueError("argument can not be null")

@deprecated("Ignore local proxy in ArgOptions is deprecated, use it from BaseOptions")
def ignore_local_proxy_environment_variables(self) -> None:
"""By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from
being picked up and used."""
self._ignore_local_proxy = True
warnings.warn(
"using ignore_local_proxy_environment_variables in ArgOptions has been deprecated, "
"instead, use it from BaseOptions",
DeprecationWarning,
stacklevel=2,
)
super()._ignore_local_proxy = True

def to_capabilities(self):
return self._caps
Expand Down