0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-06-16 00:04:48 +02:00

Headless new mode introduced for chrome

This commit is contained in:
Arne Tarara 2023-10-02 13:09:43 +02:00
parent e77d27ed5b
commit 6e3ddc458a
No known key found for this signature in database
GPG key ID: 2540198A4079785B
6 changed files with 45 additions and 36 deletions

View file

@ -11,10 +11,11 @@ def log_note(message: str) -> None:
def create_user(playwright: Playwright, browser_name: str, username: str, password: str) -> None:
log_note(f"Launch browser {browser_name}")
if browser_name == "firefox":
browser_type = playwright.firefox
browser = playwright.firefox.launch(headless=True)
else:
browser_type = playwright.chromium
browser = browser_type.launch(headless=True)
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
context = browser.new_context()
try:
page = context.new_page()