Get the browser to use for Playwright. Reads from PLAYWRIGHT_BROWSER environment variable, defaults to firefox. Options: chrome, firefox, webkit, msedge Firefox is recommended for lower CPU usage.
()
| 93 | |
| 94 | |
| 95 | def get_playwright_browser() -> str: |
| 96 | """ |
| 97 | Get the browser to use for Playwright. |
| 98 | |
| 99 | Reads from PLAYWRIGHT_BROWSER environment variable, defaults to firefox. |
| 100 | Options: chrome, firefox, webkit, msedge |
| 101 | Firefox is recommended for lower CPU usage. |
| 102 | """ |
| 103 | value = os.getenv("PLAYWRIGHT_BROWSER", DEFAULT_PLAYWRIGHT_BROWSER).strip().lower() |
| 104 | if value not in VALID_PLAYWRIGHT_BROWSERS: |
| 105 | print(f" - Warning: Invalid PLAYWRIGHT_BROWSER='{value}', " |
| 106 | f"valid options: {', '.join(sorted(VALID_PLAYWRIGHT_BROWSERS))}. " |
| 107 | f"Defaulting to {DEFAULT_PLAYWRIGHT_BROWSER}") |
| 108 | return DEFAULT_PLAYWRIGHT_BROWSER |
| 109 | return value |
| 110 | |
| 111 | |
| 112 | def get_extra_read_paths() -> list[Path]: |