Search code examples
javascripttypescriptbrowserplaywright

Playwright - how to locate browser path at run-time


I'm trying to get the path of the browser's executable path inside my test.

I have to get that path in order to add a specific browser policy (Chromium) at the beginning of the test.


Solution

  • Fortunately Playwright has a built-In method executablePath() for that:

    test("my test", async ({ browser, page }) => {
      await page.goto("/");
      browser.browserType().executablePath()
    });