您现在的位置是:网站首页 > 博客日记 >

playwright环境配置

作者:YXN-python 阅读量:79 发布日期:2024-09-19

1、安装

pip install playwright

2、安装驱动

安装所有驱动

playwright install

安装指定驱动

# Firefox
playwright install firefox

# Chromium
playwright install chromium

# WebKit
playwright install webkit

指定需要启动的浏览器

from playwright.sync_api import sync_playwright

with sync_playwright() as pw:
    browser = pw.chromium.launch(headless=False, channel="chromium")
    page = browser.new_page()
    page.goto("https://www.baidu.com/")

 

 

 

 

 

 

YXN-python

2024-09-19