playwright窗口最大化
from playwright.sync_api import sync_playwright playwright = sync_playwright().start() browser = playwright.chromium.launch(headless=False, args=["--start-maximized"]) context = browser.new_context(no_viewport=True) page = context.new_page() page.goto("www.baidu.com")
窗口最大话
class TestLiXiang: def setup_method(self) -> None: self.playwright = sync_playwright().start() self.browser = self.playwright.chromium.launch(headless=False) self.context = self.browser.new_context(viewport={'width': 1800, 'height': 1024}) self.page = self.context.new_page()
打开指定大小的窗口