-
安裝 (
Playwright
支持Async\Await
語法,故需要Python3.7+
)sh複製代碼$ pip install playwright
-
2)安裝
Chromium
、Firefox
、WebKit
等瀏覽器的驅動文件(內置瀏覽器)和ffmpeg
用於視頻錄製注意,下面這種安裝方式安裝,會安裝所有驅動文件,如果需要打包成
exe/app
文件還會報錯 Please run the following command to download new browsers,所以可以按需安裝就行。sh複製代碼# 全裝 $ python -m playwright install # 按需安裝,重新安裝一下(chromium 是其中一個瀏覽器插件,看自己用什麼就裝什麼) # Expecting one of: chromium, chrome, chrome-beta, msedge, msedge-beta, msedge-dev, firefox, webkit # PLAYWRIGHT_BROWSERS_PATH=0 是爲了支持 pyinstaller 打包報錯 Please run the following command to download new browsers 問題 $ PLAYWRIGHT_BROWSERS_PATH=0 playwright install chromium