zhbbk

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()

打开指定大小的窗口

posted on 2022-06-16 17:46  EF9CY  阅读(2863)  评论(0编辑  收藏  举报

导航