Skip to content

Commit 10141c5

Browse files
[py] Use ssl_proxy descriptor when initializing Proxy from raw dict (#18237)
Co-authored-by: Corey Goldberg <[email protected]>
1 parent 6346724 commit 10141c5

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎py/selenium/webdriver/common/proxy.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def __init__(self, raw: dict | None = None):
132132
if raw.get("proxyAutoconfigUrl"):
133133
self.proxy_autoconfig_url = raw["proxyAutoconfigUrl"]
134134
if raw.get("sslProxy"):
135-
self.sslProxy = raw["sslProxy"]
135+
self.ssl_proxy = raw["sslProxy"]
136136
if raw.get("autodetect"):
137137
self.auto_detect = raw["autodetect"]
138138
if raw.get("socksProxy"):

‎py/test/selenium/webdriver/common/proxy_tests.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,14 @@ def test_can_init_empty_proxy():
135135
proxy_capabilities = {}
136136
proxy_capabilities["proxyType"] = "unspecified"
137137
assert proxy_capabilities == options.to_capabilities().get("proxy")
138+
139+
140+
def test_can_init_manual_proxy_with_ssl_proxy_only():
141+
proxy = Proxy(raw={"sslProxy": "ssl.proxy:1234"})
142+
assert ProxyType.MANUAL == proxy.proxy_type
143+
assert "ssl.proxy:1234" == proxy.ssl_proxy
144+
145+
146+
def test_cannot_set_ssl_proxy_when_direct_proxy_type():
147+
with pytest.raises(ValueError):
148+
Proxy(raw={"proxyType": "direct", "sslProxy": "ssl.proxy:1234"})

0 commit comments

Comments
 (0)