定义:
Playwright是微软发布的一个web自动化框架,支持多种浏览器(Chromeium、Firefox、WebKit),支持多种操作系统(Windows、Linux、macOS),支持移动端web测试,支持多语言(python、java、node.js、c#),支持有头/无头模式,自动等待,内置pytest模式。
安装Palywright:
pip install playwright # 安装playwright playwright install # 安装自带浏览器和视频录制功能
使用国内镜像源安装:
https://pypi.douban.com/simple/ 豆瓣 https://mirrors.aliyun.com/pypi/simple/ 阿里 https://pypi.hustunique.com/simple/ 华中理工大学 https://pypi.sdutlinux.org/simple/ 山东理工大学 https://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 清华 示例: pip install playwright -i https://mirrors.aliyun.com/pypi/simple/
Playwright录制功能:
在cmd输入命令打开浏览器窗口和录制窗口。
playwright codegen https://www.baidu.com