Skip to content

Commit 001088b

Browse files
committed
Do some refactoring
1 parent fc684c3 commit 001088b

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

seleniumbase/core/proxy_helper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ def create_proxy_ext(
2727
if not bypass_list:
2828
bypass_list = ""
2929
if proxy_string:
30-
proxy_host = proxy_string.split(":")[0]
30+
proxy_protocol = ""
31+
if proxy_string.count("://") == 1:
32+
proxy_protocol = proxy_string.split("://")[0] + "://"
33+
proxy_string = proxy_string.split("://")[1]
34+
proxy_host = proxy_protocol + proxy_string.split(":")[0]
3135
proxy_port = proxy_string.split(":")[1]
3236
background_js = (
3337
"""var config = {\n"""

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,17 @@ def test_example(self):
199199
Eg. "python my_test.py" instead of "pytest my_test.py"."""
200200
if name == "__main__": # Test called with "python"
201201
import subprocess
202-
from pytest import main as pytest_main
203202
all_args = []
204203
for arg in args:
205204
all_args.append(arg)
206205
for arg in sys.argv[1:]:
207206
all_args.append(arg)
208-
multi = False
209-
for arg in all_args:
210-
if arg.startswith("-n") or arg.startswith("--numprocesses"):
211-
multi = True
212-
if multi:
213-
subprocess.call(
214-
[sys.executable, "-m", "pytest", file, "-s", *all_args]
215-
)
216-
else:
217-
pytest_main([file, "-s", *all_args])
207+
# See: https://stackoverflow.com/a/54666289/7058266
208+
# from pytest import main as pytest_main
209+
# pytest_main([file, "-s", *all_args])
210+
subprocess.call(
211+
[sys.executable, "-m", "pytest", file, "-s", *all_args]
212+
)
218213

219214
def open(self, url):
220215
"""Navigates the current browser window to the specified page."""
@@ -13586,15 +13581,6 @@ def __disable_beforeunload_as_needed(self):
1358613581

1358713582
############
1358813583

13589-
@decorators.deprecated("The Driver Manager prevents old drivers.")
13590-
def is_chromedriver_too_old(self):
13591-
"""Before chromedriver 73, there was no version check, which
13592-
means it's possible to run a new Chrome with old drivers."""
13593-
self.__fail_if_not_using_chrome("is_chromedriver_too_old()")
13594-
if int(self.get_chromedriver_version().split(".")[0]) < 73:
13595-
return True # chromedriver is too old! Please upgrade!
13596-
return False
13597-
1359813584
@decorators.deprecated("You should use re.escape() instead.")
1359913585
def jq_format(self, code):
1360013586
# DEPRECATED - re.escape() already performs this action.

0 commit comments

Comments
 (0)