0
点赞
收藏
分享

微信扫一扫

playwright模拟浏览器


playwright是微软开源的自动化UI测试工具,支持Chrome、Firefox、Edge等多种浏览器,兼容多种语言、多种操作系统。

安装

pip install pytest-playwright
playwright install

测试

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
url = "https://www.xxx.com"
page.goto(url, wait_until= "networkidle")
print(page.title())
print(page.content())
browser.close()

参考

​​https://github.com/microsoft/playwright​​​ https://playwright.dev/python/docs/intro
https://playwright.dev/python/docs/api/class-playwright


举报

相关推荐

0 条评论