Playwright

Playwright

install

1
2
3
pip install --upgrade pip
pip install playwright
playwright install / playwright install chromium

note

  • 使用 page.wait_for_timeout(5000) 进行 wait
  • Playwright 的 API 不是线程安全的。若在多线程环境中使用 Playwright,应该为每个线程创建一个 Playwright 实例。
  • 默认情况下,Playwright 会自动关闭对话框,因此您无需处理它们(alert()、confirm()、prompt())。但是,您可以在触发对话框的操作发生之前注册一个对话框处理程序,以选择 dialog.accept() 或 dialog.dismiss() 它。