Rayrun
← Back to Discord Forum

local browser error

Playwright is trying to run the browser as a browser installed on the local PC. However, an error occurs. What's the problem?

playwright.config.ts import { defineConfig, devices } from '@playwright/test';

export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { trace: 'on-first-retry', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'], launchOptions: { executablePath: 'C:\Program Files\Google\Chrome\Application\chrome.exe', }, headless: false, }, },

test-1.spec.ts const { chromium } = require('@playwright/test');

(async () => { const browser = await chromium.launch({ headless: false, executablePath: 'C:\Program Files\Google\Chrome\Application\chrome.exe', });

This thread is trying to answer question "Why does an error occur when trying to run Playwright tests using the locally installed Chrome browser instead of Chromium?"

12 replies

You've not said anything at all about what the error is... are we meant to just guess?

I guess it must be caused by something that you've done wrong.

hello

If you run it, you will not be able to run it using the Chrome browser installed on your PC.

It only runs with Chromium. What I want is to run it with Chrome in the path installed on my PC.

Yes, I understand that. But you said "an error occurs" without telling us what the error message is.

[{ "resource": "/c:/Users/yusal/eql/playwright.config.ts", "owner": "typescript", "code": "2769", "severity": 8, "message": "No overload matches this call.\n The last overload gave the following error.\n Object literal may only specify known properties, and 'executablePath' does not exist in type 'UseOptions<PlaywrightTestOptions & CustomProperties<unknown>, PlaywrightWorkerOptions & CustomProperties<unknown>>'.", "source": "ts", "startLineNumber": 14, "startColumn": 5, "endLineNumber": 14, "endColumn": 19, "relatedInformation": [ { "startLineNumber": 1437, "startColumn": 3, "endLineNumber": 1437, "endColumn": 6, "message": "The expected type comes from property 'use' which is declared here on type 'PlaywrightTestConfig<unknown, unknown>'", "resource": "/c:/Users/yusal/eql/node_modules/playwright/types/test.d.ts" }, { "startLineNumber": 7082, "startColumn": 17, "endLineNumber": 7082, "endColumn": 29, "message": "The last overload is declared here.", "resource": "/c:/Users/yusal/eql/node_modules/playwright/types/test.d.ts" } ] }]

No overload matches this call. The last overload gave the following error. Object literal may only specify known properties, and 'executablePath' does not exist in type 'UseOptions<PlaywrightTestOptions & CustomProperties<unknown>, PlaywrightWorkerOptions & CustomProperties<unknown>>'.ts(2769) test.d.ts(1437, 3): The expected type comes from property 'use' which is declared here on type 'PlaywrightTestConfig<unknown, unknown>' test.d.ts(7082, 17): The last overload is declared here.

It runs in existing browsers, but an error occurs.

Error: browserType.launchPersistentContext: Target page, context or browser has been closed

Curious if remove the: launchOptions: { executablePath: 'C:\Program Files\Google\Chrome\Application\chrome.exe', }, and make sure you install chrome with: npx playwright install-deps chromium You still get the error?

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.