update refactoring and add new features
This commit is contained in:
@@ -7,7 +7,10 @@ import `plugins.playwright` even when Playwright itself is not installed.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .runtime import USER_AGENT
|
||||
|
||||
__all__ = [
|
||||
"USER_AGENT",
|
||||
"PlaywrightTimeoutError",
|
||||
"PlaywrightTool",
|
||||
"PlaywrightDefaults",
|
||||
|
||||
@@ -65,15 +65,18 @@ def _find_filename_from_cd(cd: str) -> Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
USER_AGENT = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/120.0.0.0 Safari/537.36"
|
||||
)
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class PlaywrightDefaults:
|
||||
browser: str = "chromium" # chromium|firefox|webkit
|
||||
headless: bool = True
|
||||
user_agent: str = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/120.0.0.0 Safari/537.36"
|
||||
)
|
||||
user_agent: str = USER_AGENT
|
||||
viewport_width: int = 1920
|
||||
viewport_height: int = 1080
|
||||
navigation_timeout_ms: int = 90_000
|
||||
|
||||
Reference in New Issue
Block a user