playwright: [Bug]: Playwright stuck at about:blank instead of opening the test page

Version

1.44.1

Steps to reproduce

I have a very basic new Playwright project setup and all I am doing for now is to try and run a test to open a page. I tried with different URLs and the result is always the same, instead of opening the test page, the browser gets stuck at about:blank.

Here’s the config file:

// @ts-check
const { defineConfig, devices } = require('@playwright/test');

/**
 * Read environment variables from file.
 * https://github.com/motdotla/dotenv
 */
// require('dotenv').config();

/**
 * @see https://playwright.dev/docs/test-configuration
 */
module.exports = defineConfig({
  testDir: './tests',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 2 : undefined,
  reporter: [['list'], ['html', { open: 'never' }]],
  timeout: 60000,
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    baseURL: 'https://www.fedex.com/en-us/',
    screenshot: 'only-on-failure',
    trace: 'on-first-retry',
    viewport: { width: 1440, height: 1080 },
    video: 'on-first-retry',
  },
  /* Configure projects for major browsers */
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
    // {
    //   name: 'firefox',
    //   use: { ...devices['Desktop Firefox'] },
    // },

    // {
    //   name: 'webkit',
    //   use: { ...devices['Desktop Safari'] },
    // },
    /* Test against mobile viewports. */
    // {
    //   name: 'Mobile Chrome',
    //   use: { ...devices['Pixel 5'] },
    // },
    // {
    //   name: 'Mobile Safari',
    //   use: { ...devices['iPhone 12'] },
    // },

    /* Test against branded browsers. */
    // {
    //   name: 'Microsoft Edge',
    //   use: { ...devices['Desktop Edge'], channel: 'msedge' },
    // },
    // {
    //   name: 'Google Chrome',
    //   use: { ...devices['Desktop Chrome'], channel: 'chrome' },
    // },
  ],
});

Here is the test file:

// @ts-check
const { test, expect } = require('@playwright/test');

test.beforeEach('Given I open the en-us homepage', async ({ page }) => {
  console.log(`Running ${test.info().title}`);
  await page.goto('home.html');
  await page.getByRole('link', { name: 'close' }).click();
});

test('Rate & Ship (example test)', async ({ page }) => {
  await test.step('When I click the Get Rate and Shipping Details button', async () => {
    await page
      .getByRole('button', { name: 'Get Rate and Shipping Details' })
      .click();
  });

  await test.step('Then I should see the options for calculating shipping rates displayed', async () => {
    await expect(
      page.getByRole('heading', { name: 'Calculate FedEx shipping rates' })
    ).toBeVisible();
    await expect(page.getByLabel('From address, type in the')).toBeVisible();
    await expect(page.getByLabel('To address, type in the full')).toBeVisible();
  });
});

Expected behavior

Bowser navigates to the test page url.

Actual behavior

Error: page.goto: Test timeout of 60000ms exceeded.
    Call log:
      - navigating to "https://www.fedex.com/en-us/home.html", waiting until "load"
 pw:api => selectors.setTestIdAttribute started +0ms
  pw:api => browserType.launch started +5ms
  pw:api <= selectors.setTestIdAttribute succeeded +8ms
  pw:api <= browserType.launch succeeded +285ms
  pw:api => browser.newContext started +2ms
  pw:api <= browser.newContext succeeded +7ms
  pw:api => browserContext.newPage started +3ms
  pw:api <= browserContext.newPage succeeded +97ms
Running Rate & Ship (example test)
  pw:api => page.goto started +2ms
  pw:api navigating to "https://www.fedex.com/en-us/home.html", waiting until "load" +2ms
  pw:api => page.screenshot started +30s
  pw:api taking page screenshot +2ms
  pw:api waiting for fonts to load... +1ms
  pw:api fonts loaded +0ms
  pw:api <= page.screenshot failed +5s
  pw:api <= page.goto failed +9ms

Additional context

If I run it by using the VS Code extension, after a few retries it will start working.

If I run it in the terminal with npx playwright test, it never works.

Also, the page I gave is just an example, I tried with other websites as well and the result is always the same.

Environment

System:
    OS: macOS 14.4.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 1.24 GB / 32.00 GB
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
  IDEs:
    VSCode: 1.89.1 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.44.1 => 1.44.1

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 16
  • Comments: 38 (6 by maintainers)

Most upvoted comments

still bugged on 1.5.2

For me, it only happens with tests using a custom fixture.

Noticed that this is prob. an error “40” (reason for the error is 40cm infront of the screen).If you use fixtures and the accidentially pass page in constructor context is switched and a new page is created.Same thin is you dhare page amongst test for long loading scenariosOn 20 Aug 2024, at 17.26, Alex Fioletov @.***> wrote: We have the same issue with out tests. Some tests randomly timeout, some are interrupted. There is no pattern - each time it’s a different set of failed test. Most of them fails on goto call. It does not matter if we run headlees mode or not. image.png (view on web) image.png (view on web) Playwright: 1.45.3 Chrome: 127.0.6533.120 (Official Build) (64-bit) Not sure if anything else can help to solve the issues.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

That works for me as well.

test.afterEach(async ({ page }) => {
    await page.close();
});

I have to manually call page.close() and it will works

I had the same problem, but I was able to avoid it by changing the verification browser from chromium to Google Chrome.

// playwright.config.js
 ...
  projects: [
    {
      name: 'Google Chrome',
      use: { ...devices['Desktop Chrome'], channel: 'chrome' },
    },
  ],
}

I don’t know why it works with normal Chrome, but I think it’s not a big problem because the only difference is whether it’s headless or not.

Risking myself for being dumb publicly, but I just installed playwright and had the same issue. When I ran it, I saw:

Image

Even when I tried to click on a test file, it kept being blank:

Image

Event when clicking on a test case:

Image

What I didn’t know, is that I had to click on a specific step AFTER the “Navigate”:

Image

Hope it helped someone who just started using Playwright 😅

Using version 1.53.0 on MacOS 15.3.2 (Sequoia)

Happens for me as well, the same about:blank page opens up and nothing happens. But for me it’s usually happening after I run the test second time from VS code extension or when I have a setup project that runs okay, but after that another browser window opens with about:blank and tests stuck.

It isn’t very pleasant, I can’t use any setup and need to run everything with each test.

@DanielStoica85 Unfortunately, I am out of ideas at this point. I’ll keep the issue open for some time, just in case someone would have an idea. If you gather more information that could be helpful, please comment here.