Always subprocess undetectable-chromedriver when used

This commit is contained in:
Michael Mintz 2022-11-04 23:50:30 -04:00
parent 2252cc3946
commit 23c2a75ea6
6 changed files with 18 additions and 12 deletions

View File

@ -2691,7 +2691,7 @@ def get_local_driver(
driver_executable_path=uc_path,
headless=False, # Xvfb needed!
version_main=uc_chrome_version,
use_subprocess=uc_subprocess,
use_subprocess=True, # Always!
)
except URLError as e:
if (
@ -2709,7 +2709,7 @@ def get_local_driver(
driver_executable_path=uc_path,
headless=False, # Xvfb needed!
version_main=uc_chrome_version,
use_subprocess=uc_subprocess,
use_subprocess=True, # Always!
)
else:
raise

View File

@ -258,8 +258,8 @@ def Driver(
undetectable = True
if (
(undetectable or undetected or uc)
and uc_subprocess is None
and uc_sub is None
and (uc_subprocess is None)
and (uc_sub is None)
):
uc_subprocess = True # Use UC as a subprocess by default.
elif (
@ -271,6 +271,8 @@ def Driver(
or "--uc-sub" in sys_argv
):
undetectable = True
if uc_subprocess is None and uc_sub is None:
uc_subprocess = True # Use UC as a subprocess by default.
else:
undetectable = False
if uc_subprocess or uc_sub:

View File

@ -920,8 +920,9 @@ def pytest_addoption(parser):
"--uc-sub", # undetected-chromedriver subprocess mode
action="store_true",
dest="uc_subprocess",
default=False,
help="""Use undetectable-chromedriver as a subprocess,
default=None,
help="""(DEPRECATED) - Setting will always be enabled.
Use undetectable-chromedriver as a subprocess,
which can help avoid issues that might result.
It may reduce UC's ability to avoid detection.""",
)

View File

@ -401,8 +401,8 @@ def SB(
undetectable = True
if (
(undetectable or undetected or uc)
and uc_subprocess is None
and uc_sub is None
and (uc_subprocess is None)
and (uc_sub is None)
):
uc_subprocess = True # Use UC as a subprocess by default.
elif (
@ -414,6 +414,8 @@ def SB(
or "--uc-sub" in sys_argv
):
undetectable = True
if uc_subprocess is None and uc_sub is None:
uc_subprocess = True # Use UC as a subprocess by default.
else:
undetectable = False
if uc_subprocess or uc_sub:

View File

@ -680,8 +680,9 @@ class SeleniumBrowser(Plugin):
"--uc-sub", # undetected-chromedriver subprocess mode
action="store_true",
dest="uc_subprocess",
default=False,
help="""Use undetectable-chromedriver as a subprocess,
default=None,
help="""(DEPRECATED) - Setting will always be enabled.
Use undetectable-chromedriver as a subprocess,
which can help avoid issues that might result.
It may reduce UC's ability to avoid detection.""",
)

View File

@ -59,7 +59,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
version_main=None,
patcher_force_close=False,
suppress_welcome=True,
use_subprocess=False,
use_subprocess=True,
debug=False,
**kw
):
@ -115,7 +115,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
suppress_welcome: (default: True)
Suppress the Chrome welcome screen that appears on first-time runs.
use_subprocess: (default: False)
use_subprocess: (default: True)
Subprocess chromedriver/python: Don't make Chrome a parent process.
"""
self.debug = debug