Merge pull request #20188 from timvandermeij/chrome-webdriverbidi

Use WebDriver BiDi for Chrome
This commit is contained in:
Tim van der Meij 2025-08-24 19:59:31 +02:00 committed by GitHub
commit 535a042b01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 32 deletions

View File

@ -2460,10 +2460,9 @@ describe("Interaction", () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
if (browserName === "firefox") {
// Skip the test for Firefox as it doesn't support the timezone
// feature yet with BiDi.
// See https://github.com/puppeteer/puppeteer/issues/13344.
// TODO: Remove this check once the issue is fixed.
// Skip the test for Firefox as it doesn't support timezone
// emulation for WebDriver BiDi yet.
// TODO: Remove this check once bug 1978027 is fixed.
return;
}

View File

@ -277,30 +277,21 @@ describe("Text layer", () => {
).then(belowEndPosition),
]);
if (browserName !== "firefox") {
await page.mouse.move(positionStart.x, positionStart.y);
await page.mouse.down({ clickCount: 1 });
await page.mouse.up({ clickCount: 1 });
await page.mouse.down({ clickCount: 2 });
} else {
// When running tests with Firefox we use WebDriver BiDi, for
// which puppeteer doesn't support emulating "double click and
// hold". We need to manually dispatch an action through the
// protocol.
// See https://github.com/puppeteer/puppeteer/issues/13745.
await page.mainFrame().browsingContext.performActions([
{
type: "pointer",
id: "__puppeteer_mouse",
actions: [
{ type: "pointerMove", ...positionStart },
{ type: "pointerDown", button: 0 },
{ type: "pointerUp", button: 0 },
{ type: "pointerDown", button: 0 },
],
},
]);
}
// Puppeteer doesn't support emulating "double click and hold" for
// WebDriver BiDi, so we must manually dispatch a protocol action
// (see https://github.com/puppeteer/puppeteer/issues/13745).
await page.mainFrame().browsingContext.performActions([
{
type: "pointer",
id: "__puppeteer_mouse",
actions: [
{ type: "pointerMove", ...positionStart },
{ type: "pointerDown", button: 0 },
{ type: "pointerUp", button: 0 },
{ type: "pointerDown", button: 0 },
],
},
]);
await moveInSteps(page, positionStart, positionEnd, 20);
await page.mouse.up();

View File

@ -1372,6 +1372,12 @@ describe("PDF viewer", () => {
// with no touch screen.
return;
}
if (browserName === "chrome") {
// Skip the test for Chrome as it doesn't support pinch zoom
// emulation for WebDriver BiDi yet.
// TODO: Remove this check once the issue is fixed.
return;
}
const rect = await getSpanRectFromText(page, 1, "type-stable");
const originX = rect.x + rect.width / 2;

View File

@ -925,10 +925,6 @@ async function startBrowser({
const printFile = path.join(tempDir, "print.pdf");
if (browserName === "chrome") {
// Run tests with the CDP protocol for Chrome only given that the Linux bot
// crashes with timeouts or OOM if WebDriver BiDi is used (issue #17961).
options.protocol = "cdp";
// Slow down protocol calls by the given number of milliseconds. In Chrome
// protocol calls are faster than in Firefox and thus trigger in quicker
// succession. This can cause intermittent failures because new protocol