playwrightplaywright-python

New to playwright, can't get any headful browsers to launch


I'm attempting to do an intro to playwright tutorial and can't get any headful browser to open. I'm working on a Windows 11 computer in jupyter notebook (a requirement for the program I'm in) and all I'm trying to do is run the pre-written code from the tutorial, as follows:

from playwright.async_api import async_playwright, expect
playwright = await async_playwright().start()
browser = await playwright.chromium.launch(headless=False)

When I run the code and try to launch a chromium browser, nothing happens. When I try to launch a firefox browser, the Nightly icon appears in my toolbar and I get a popup asking if I want to open Nightly in troubleshoot mode. But when I click open, the Nightly icon disappears and nothing happens.

Any advice or pointers are much appreciated!


Solution

  • await playwright.chromium.launch(headless=False)
    

    Opens an empty browser, if you didn't state any further actions such as goto() it will open and browser and close it immediately.

    Try running a single test() that navigates to a URL, and include await page.pause() to verify if the browser displays the URL you navigated to.