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

View File

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

View File

@ -1372,6 +1372,12 @@ describe("PDF viewer", () => {
// with no touch screen. // with no touch screen.
return; 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 rect = await getSpanRectFromText(page, 1, "type-stable");
const originX = rect.x + rect.width / 2; const originX = rect.x + rect.width / 2;

View File

@ -925,10 +925,6 @@ async function startBrowser({
const printFile = path.join(tempDir, "print.pdf"); const printFile = path.join(tempDir, "print.pdf");
if (browserName === "chrome") { 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 // Slow down protocol calls by the given number of milliseconds. In Chrome
// protocol calls are faster than in Firefox and thus trigger in quicker // protocol calls are faster than in Firefox and thus trigger in quicker
// succession. This can cause intermittent failures because new protocol // succession. This can cause intermittent failures because new protocol