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?"
[{ "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.
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 [email protected].