install:: pip3 install playwright
import:: from playwright.sync_api import sync_playwright
doc:: Playwright Python
通过 pip 安装完成后,需要先进行初始化:
playwright install
之后才能使用,也可以指定要安装的浏览器以节约时间:playwright install chromium
。
另外大部分时候需要安装系统依赖:playwright install-deps
默认保存位置:
%USERPROFILE%\AppData\Local\ms-playwright
on Windows
~/Library/Caches/ms-playwright
on macOS
~/.cache/ms-playwright
on Linux