Skip to content

Commit ccc2c72

Browse files
committed
Update multi-thread detection
1 parent 4648094 commit ccc2c72

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ def _add_chrome_proxy_extension(
103103
""" Implementation of https://stackoverflow.com/a/35293284 for
104104
https://stackoverflow.com/questions/12848327/
105105
(Run Selenium on a proxy server that requires authentication.) """
106-
if not ("-n" in sys.argv or "".join(sys.argv) == "-c"):
106+
arg_join = " ".join(sys.argv)
107+
if not ("-n" in sys.argv or "-n=" in arg_join or arg_join == "-c"):
107108
# Single-threaded
108109
proxy_helper.create_proxy_zip(proxy_string, proxy_user, proxy_pass)
109110
else:
@@ -537,7 +538,8 @@ def get_local_driver(
537538
logging.debug("\nWarning: Could not make geckodriver"
538539
" executable: %s" % e)
539540
elif not is_geckodriver_on_path():
540-
if not ("-n" in sys.argv or "".join(sys.argv) == "-c"):
541+
args = " ".join(sys.argv)
542+
if not ("-n" in sys.argv or "-n=" in args or args == "-c"):
541543
# (Not multithreaded)
542544
from seleniumbase.console_scripts import sb_install
543545
sys_args = sys.argv # Save a copy of current sys args
@@ -605,7 +607,8 @@ def get_local_driver(
605607
logging.debug("\nWarning: Could not make edgedriver"
606608
" executable: %s" % e)
607609
elif not is_edgedriver_on_path():
608-
if not ("-n" in sys.argv or "".join(sys.argv) == "-c"):
610+
args = " ".join(sys.argv)
611+
if not ("-n" in sys.argv or "-n=" in args or args == "-c"):
609612
# (Not multithreaded)
610613
from seleniumbase.console_scripts import sb_install
611614
sys_args = sys.argv # Save a copy of current sys args
@@ -658,7 +661,8 @@ def get_local_driver(
658661
logging.debug("\nWarning: Could not make chromedriver"
659662
" executable: %s" % e)
660663
elif not is_chromedriver_on_path():
661-
if not ("-n" in sys.argv or "".join(sys.argv) == "-c"):
664+
args = " ".join(sys.argv)
665+
if not ("-n" in sys.argv or "-n=" in args or args == "-c"):
662666
# (Not multithreaded)
663667
from seleniumbase.console_scripts import sb_install
664668
sys_args = sys.argv # Save a copy of current sys args

0 commit comments

Comments
 (0)