Why am i getting this error?
Error: browserType.launch: Browser.enable): Browser closed.
I have also attached a picture of the error!
My machine is Macbook Pro M1. Below is my code:
`const { test, expect, chromium, firefox } = require('@playwright/test');
test.describe('Login Test Block', async () => {
test('should display the login page if login credentials inputted are correct', async () => {
// closes unexpectedly
const browser = await firefox.launch({
executablePath: '/Applications/Firefox.app/Contents/MacOS/Firefox',
channel: 'firefox',
headless: false,
});
const page = await browser.newPage();
await page.goto('/example-3');
await page.locator('[data-cy=input-email]').fill('[email protected]');
await page.locator('[data-cy=input-password]').fill('123456789');
await page.locator('[data-cy=input-password]').fill('123456789');
await page.locator('[data-cy=login-button]').click();
// Assert that the successful login message is visible
expect(await page.locator('[data-cy=successful-login]').isVisible()).toBe(true);
});
});`
This thread is trying to answer question "Why am I getting the 'Error: browserType.launch: Browser.enable): Browser closed.' error while launching a browser using Playwright test on a Macbook Pro M1? Can I test different test cases on different web browser versions using Playwright?"
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].