2024-02-01

How to cache playwright-python contexts for testing?

I am doing some web scraping using playwright-python>=1.41, and have to launch the browser in a headed mode (e.g. launch(headless=False).

For CI testing, I would like to somehow cache the headed interactions with Chromium, to enable offline testing:

  • First invocation: uses Chromium to make real-world HTTP transactions
  • Later invocations: uses Chromium, but all HTTP transactions read from a cache

How can this be done? I can't find any clear answers on how to do this.



No comments:

Post a Comment