Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump puppeteer to v22.4.1 (HeadlessChrome/122.0.0.0) #1349

Merged
merged 4 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extensions/devices/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

module.exports = function (phantomas) {
const puppeteer = require("puppeteer"),
devices = puppeteer.devices,
// @see https://github.com/GoogleChrome/puppeteer/blob/master/DeviceDescriptors.js
devices = puppeteer.KnownDevices,
// @see https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/common/Device.ts
availableDevices = {
phone: "Galaxy S5", // 360x640
"phone-landscape": "Galaxy S5 landscape", // 640x360
tablet: "Kindle Fire HDX", // 800x1200
"tablet-landscape": "Kindle Fire HDX landscape", // 1280x800
};

var device;
let device;

// check if --phone or --tablet option was passed
Object.keys(availableDevices).forEach(function (item) {
Expand Down
6 changes: 4 additions & 2 deletions extensions/postLoadDelay/postLoadDelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
"use strict";

const { setTimeout } = require("timers/promises");

module.exports = function (phantomas) {
// e.g. --post-load-delay 5
var delay = parseInt(phantomas.getParam("post-load-delay"), 10);
Expand All @@ -14,9 +16,9 @@ module.exports = function (phantomas) {
// https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#framewaitforselectororfunctionortimeout-options-args
phantomas.log("Will wait %d second(s) after load", delay);

phantomas.on("beforeClose", (page) => {
phantomas.on("beforeClose", async () => {
phantomas.log("Sleeping for %d seconds", delay);

return page.waitForTimeout(delay * 1000);
return setTimeout(delay * 1000);
});
};
Loading
Loading