mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-04-26 09:55:35 +02:00
Add browser headless mode for Windows
This commit is contained in:
@@ -119,6 +119,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||
suppress_welcome=True,
|
||||
use_subprocess=False,
|
||||
debug=False,
|
||||
windows_headless=False,
|
||||
**kw
|
||||
):
|
||||
"""
|
||||
@@ -384,17 +385,21 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||
if not desired_capabilities:
|
||||
desired_capabilities = options.to_capabilities()
|
||||
|
||||
if not use_subprocess:
|
||||
if not use_subprocess and not windows_headless:
|
||||
self.browser_pid = start_detached(
|
||||
options.binary_location, *options.arguments
|
||||
)
|
||||
else:
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
if os.name == 'nt' and windows_headless:
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
browser = subprocess.Popen(
|
||||
[options.binary_location, *options.arguments],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
close_fds=IS_POSIX,
|
||||
startupinfo=startupinfo
|
||||
)
|
||||
self.browser_pid = browser.pid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user