Skip to content

Commit

Permalink
fix: supress viewport errors for pages that do not support changing it (
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Feb 22, 2024
1 parent 5bbee10 commit 753a954
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/puppeteer-core/src/cdp/EmulationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,23 @@ export class EmulationManager {
const hasTouch = viewport.hasTouch || false;

await Promise.all([
client.send('Emulation.setDeviceMetricsOverride', {
mobile,
width,
height,
deviceScaleFactor,
screenOrientation,
}),
client
.send('Emulation.setDeviceMetricsOverride', {
mobile,
width,
height,
deviceScaleFactor,
screenOrientation,
})
.catch(err => {
if (
err.message.includes('Target does not support metrics override')
) {
debugError(err);
return;
}
throw err;
}),
client.send('Emulation.setTouchEmulationEnabled', {
enabled: hasTouch,
}),
Expand Down

0 comments on commit 753a954

Please sign in to comment.