1
0
Fork 0
mirror of synced 2024-06-30 20:10:35 +12:00

add explicitly specify --headless=new

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-03-17 19:30:14 +09:00
parent f5e631dbfa
commit 44a5a5ed7e
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA

View file

@ -219,7 +219,7 @@ def get_headers(url: str, timeout: int=None) -> str:
def chrome_args(**options) -> List[str]: def chrome_args(**options) -> List[str]:
"""helper to build up a chrome shell command with arguments""" """helper to build up a chrome shell command with arguments"""
from .config import CHROME_OPTIONS from .config import CHROME_OPTIONS, CHROME_VERSION
options = {**CHROME_OPTIONS, **options} options = {**CHROME_OPTIONS, **options}
@ -229,6 +229,9 @@ def chrome_args(**options) -> List[str]:
cmd_args = [options['CHROME_BINARY']] cmd_args = [options['CHROME_BINARY']]
if options['CHROME_HEADLESS']: if options['CHROME_HEADLESS']:
if int(CHROME_VERSION.split()[1].split('.')[0]) >= 111:
cmd_args += ("--headless=new",)
else:
cmd_args += ('--headless',) cmd_args += ('--headless',)
if not options['CHROME_SANDBOX']: if not options['CHROME_SANDBOX']: