Rayrun
← Back to Discord Forum

Error: browserType.launch: Browser.enable): Browser closed.

.masoodahmedposted in #help-playwright
Open in Discord
.masoodahmed
.masoodahmed

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);
});

});`

Screenshot_2023-06-14_at_5.35.44_PM.png

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?"

5 replies

its not supported to set the executable to the firefox binary. You need to use Playwright's firefox.

.masoodahmed
.masoodahmed

Okay, Thank You!

.masoodahmed
.masoodahmed

So we cannot test different test cases on different web browser versions like firefox version 92 and firefoc version 112 and similarly chrome version 114 and chrome version 110 or something

Yes, its strictly bound to the Playwright version you are using. We recommend testing with the latest Playwright, that has the browser versions your users are using.

.masoodahmed
.masoodahmed

Thank You!

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