Skip to content

Commit 40bdc00

Browse files
committed
Add the "--proxy=STRING" option for manager formats
1 parent ad9faec commit 40bdc00

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

seleniumbase/plugins/driver_manager.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,16 @@ def Driver(
251251
is_mobile = False
252252
test_id = "direct_driver"
253253
proxy_string = proxy
254+
if proxy_string is None and "--proxy" in arg_join:
255+
if "--proxy=" in arg_join:
256+
proxy_string = arg_join.split("--proxy=")[1].split(" ")[0]
257+
elif "--proxy " in arg_join:
258+
proxy_string = arg_join.split("--proxy ")[1].split(" ")[0]
259+
if proxy_string:
260+
if proxy_string.startswith('"') and proxy_string.endswith('"'):
261+
proxy_string = proxy_string[1:-1]
262+
elif proxy_string.startswith("'") and proxy_string.endswith("'"):
263+
proxy_string = proxy_string[1:-1]
254264
user_agent = agent
255265
recorder_mode = False
256266
if recorder_ext:

seleniumbase/plugins/sb_manager.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,16 @@ def SB(
312312
if is_mobile:
313313
sb_config.mobile_emulator = True
314314
proxy_string = proxy
315+
if proxy_string is None and "--proxy" in arg_join:
316+
if "--proxy=" in arg_join:
317+
proxy_string = arg_join.split("--proxy=")[1].split(" ")[0]
318+
elif "--proxy " in arg_join:
319+
proxy_string = arg_join.split("--proxy ")[1].split(" ")[0]
320+
if proxy_string:
321+
if proxy_string.startswith('"') and proxy_string.endswith('"'):
322+
proxy_string = proxy_string[1:-1]
323+
elif proxy_string.startswith("'") and proxy_string.endswith("'"):
324+
proxy_string = proxy_string[1:-1]
315325
user_agent = agent
316326
recorder_mode = False
317327
if recorder_ext:

0 commit comments

Comments
 (0)