最近需要用到它,但是吧老是忘记怎么运行的;记录一下免得我自己忘记:
python 安装 playwrigt
pip install playwright
安装Chromium、Firefox、WebKit等浏览器的驱动文件(内置浏览器)
python -m playwright install
开启playwrigt工作
python -m playwright codegen 页面地址,从这里开始录制;
python -m playwright codegen --target python -o ‘my.py’ -b chromium 页面地址
target:规定生成脚本的语言,有JS和Python两种,默认为Python
b:指定浏览器驱动
o:将录制的脚本保存到一个文件
使用 Chromium驱动,打开地址页面,将结果保存为my.py的python文件
python -m playwright codegen --help 查看帮助