pyppeteer 相比与selenium优秀,但是搜索后发现长时间未有维护,非官方的python版本也不是很稳定,个人就想找一个新的爬虫库。
因此找到了爬虫新库playwright,它具备强大的爬虫功能,目前看要比selenium稳定高效,接口也较为容易理解。
https://playwright.dev/python/docs/intro
#安装
pip
pip install --upgrade pip
pip install playwright
playwright install
#conda
conda config --add channels conda-forge
conda config --add channels microsoft
conda install playwright
playwright install
first script
#同步
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("http://playwright.dev"