Headful / headed runs failing on GitHub Actions (python-playwright / Chromium / Linux)
See original GitHub issueI can’t get headful runs to work using python-playwright
; I keep getting Unable to open X display.
.
I’ve tried for months with the recommended setup at https://playwright.dev/python/docs/ci#running-headed, and just today tried adding --server-args="-screen 0 1280x960x24"
to the xvfb-run
command to match your (passing) example here, but it’s still not working.
I got some errors about the Chromium sandbox, so I added
chromium_sandbox=False,
args=["--no-sandbox", "--disable-setuid-sandbox"],
but that didn’t seem to help.
Currently on python 3.9.5, python-playwright 1.11.0, Ubuntu-20.04.
You can see my config at: https://github.com/n8henrie/pycookiecheat/blob/dev/.github/workflows/python-package.yml
At the time of opening this issue, it is:
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: microsoft/playwright-github-action@v1
- name: Install tox
run: python -m pip install tox
- name: Run tox
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- python -m tox -e py
- name: Lint
run: python -m tox -e lint
You can see my dozens of failing attempts to get this to run at: https://github.com/n8henrie/pycookiecheat/actions – I’d love to hear any suggestions!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
@mxschmitt – You’re correct, it had to do with
tox
clearing the environment variables.Specifically, adding this to my GitHub Actions yaml file resolved the issue:
Full working example: https://github.com/n8henrie/pycookiecheat/blob/3458862a4c99c83ae9017fe52ae6ec49216c745d/.github/workflows/python-package.yml#L16
Alternatively, I could have used the
passenv
key intox.ini
.This was such a pain to sort out that I wrote up a blog post of my procedure here.
Thanks for pointing me in the right direction!
Awesome news! 💯