pythonplaywrightplaywright-test

Playwright uses old browser version


I'm a bit of a Playwright noob, and I have a problem getting my Python scripts to run using the latest version of Firefox.

Any .py script I run will open in version 95.0. Same thing if I run playwright codegen -b firefox. However, if I run npx playwright codegen -b firefox, I get the correct version 134.0. I've tried npx playwright install and playwright install to get the latest browsers. The npx attempt did seem to update correctly, but I'm still just getting the old Firefox when running my .py scripts.

Am I missing something really obvious?


Solution

  • You are mixing python and nodejs here. .py are python files so I assume you're using Python to write your tests. But npx is the node package runner/executor.

    The fact that you have an older version of browsers probably occurs due to old Playwright version.

    First update your playwright library to the latest version:

    pip install pytest-playwright playwright -U
    

    And than, rerun playwright install to install all browsers or playwright install firefox to install firefox only.

    Please note that I've assumed that you are using Python. But if you're using Nodejs, please comment and I will update my answer.