Playwright on Val Town

Playwright on Val Town has a few challenges:

  • You can't run a browser on Val Town, since Val Town can only run Deno Typescript code
  • Playwright requires file system access to work (it makes an artifacts temp dir)

To get around needing a full browser, we can use Steel. They let you run browsers on their cloud easily and for free (up to a limit). To get around the file system issue, we can stub node:fs using this small script.

This example is directly from their homepage, with no modification other than adding import "https://esm.town/v/wolf/StubFS/stubFs.ts".

You can set "TMPDIR" to "/tmp" in your environmental variables if you wish not to get warnings about it being unset.