Deploying python playwright application on render

I made a python application which also uses playwright in headless=False mode. It works fine on my mac but on deploying it on render.com I get this:

ERROR - Executable doesn't exist at /opt/render/.cache/ms-playwright/chromium-1064/chrome-linux/chrome

Looks like Playwright was just installed or updated.       ║
║ Please run the following command to download new browsers: ║
║                                                            ║
║     playwright install

I updated the build command to be pip install requirements.txt && playwright install, but I still get the same error.

I understand that I will have to use a docker but I have no idea how to do so, can anyone help?

Hi,

There are other topics in this community about Playwright and Chrome, e.g.: https://community.render.com/t/playwright-install-with-chromium/11218

Alan

I tried it, but I want to run it in headed mode, and I am getting
║ Looks like you launched a headed browser without having a XServer running. ║ ║ Set either 'headless: true' or use 'xvfb-run <your-playwright-app>' before running Playwright. ║
How do I fix this? I added xvfb-run but now I am getting " xvfb-run: error: xauth command not found"

Here is what my build file looks like:

#!/usr/bin/env bash
set -e

pip install -r requirements.txt

playwright install

# Store/pull Playwright cache with build cache
if [[ ! -d $PLAYWRIGHT_BROWSERS_PATH ]]; then 
  echo "...Copying Playwright Cache from Build Cache" 
  cp -R $XDG_CACHE_HOME/playwright/ $PLAYWRIGHT_BROWSERS_PATH
else 
  echo "...Storing Playwright Cache in Build Cache" 
  cp -R $PLAYWRIGHT_BROWSERS_PATH $XDG_CACHE_HOME
fi

xvfb-run comment.py

Please help

xauth is not available on Render Native Runtimes. If you need custom OS-level packages you’ll need to use Docker to set up your own environment as you require.

Alan