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

View File

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

View File

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

View File

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

View File

@ -680,8 +680,9 @@ class SeleniumBrowser(Plugin):
"--uc-sub", # undetected-chromedriver subprocess mode "--uc-sub", # undetected-chromedriver subprocess mode
action="store_true", action="store_true",
dest="uc_subprocess", dest="uc_subprocess",
default=False, default=None,
help="""Use undetectable-chromedriver as a subprocess, help="""(DEPRECATED) - Setting will always be enabled.
Use undetectable-chromedriver as a subprocess,
which can help avoid issues that might result. which can help avoid issues that might result.
It may reduce UC's ability to avoid detection.""", 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, version_main=None,
patcher_force_close=False, patcher_force_close=False,
suppress_welcome=True, suppress_welcome=True,
use_subprocess=False, use_subprocess=True,
debug=False, debug=False,
**kw **kw
): ):
@ -115,7 +115,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
suppress_welcome: (default: True) suppress_welcome: (default: True)
Suppress the Chrome welcome screen that appears on first-time runs. 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. Subprocess chromedriver/python: Don't make Chrome a parent process.
""" """
self.debug = debug self.debug = debug