puppeteer: [Regression]: `page.goto` API throws a `TypeError` if Firefox uses the WebDriverBiDi protocol

Minimal, reproducible example

import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  product: "firefox",
  headless: false,
  protocol: "webDriverBiDi",
});
const pages = await browser.pages();
const page = pages[0];
await page.goto("https://github.com/puppeteer/puppeteer");

Error string

TypeError: Cannot read properties of undefined (reading ‘goto’)

Bug behavior

  • Flaky
  • PDF

Background

For Mozilla’s PDF.js project we use Puppeteer to run our browser tests, and recently in https://github.com/mozilla/pdf.js/pull/17172 the test suite was updated to let Firefox run with the WebDriverBiDi protocol. However, updating Puppeteer from 22.0.0 to 22.1.0 today suddenly caused Firefox to no longer start with TypeError: Cannot read properties of undefined (reading 'goto') when trying to visit our test runner page.

The issue is reproducible with the following steps:

  1. Install Puppeteer 22.0.0.
  2. Create repro.js with the provider reproducer script.
  3. Run node repro.js and notice that Firefox works and navigates to the Puppeteer GitHub page.
  4. Install Puppeteer 22.1.0.
  5. Run node repro.js again and notice that Firefox quickly shows up and then exits once the page.goto API is called. The type error mentioned above is logged.

Note that the reproducer script works fine in Puppeteer 22.1.0 if the protocol is set to CDP, so this seems to be a WebDriverBiDi-specific issue. Unless I’ve missed something I can’t find anything in the Puppeteer 22.1.0 changelog that would suggest that this way of using page.goto is no longer valid (and that’d probably be a breaking change anyway so I wouldn’t expect that in a minor version release as well).

/cc @whimboo @OrKoN as you might be interested in this given that the introduction of WebDriverBiDi in PDF.js was also done to spot any WebDriverBiDi issues as soon as possible now that WebDriverBiDi development is ongoing.

Expectation

The reproducer script should correctly launch Firefox and open the Puppeteer GitHub page in both Puppeteer 22.0.0 and Puppeteer 22.1.0.

Reality

The reproducer script only correctly launches Firefox and opens the Puppeteer GitHub page in Puppeteer 22.0.0, but in Puppeteer 22.1.0 a TypeError is thrown.

Puppeteer configuration file (if used)

No response

Puppeteer version

22.1.0

Node version

21.6.2

Package manager

npm

Package manager version

10.4.0

Operating system

Linux

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 1
  • Comments: 17

Most upvoted comments

Just spoke internally about this problem and it’s not visible anymore when upgrading to 22.3.0.

I would suggest closing the issue.

Interestingly the cached version of Firefox was from January 30th. Removing it and re-fetching the latest Nightly build fixes the issue for me.

@timvandermeij can you please check if you have an older Nightly build cached (in CI) as well?

Thanks for filing. It looks like this is not goto throwing but rather the initial page is undefined.