Skip to content

Commit

Permalink
Merge pull request #1349 from macbre/puppeteer/22.4.1
Browse files Browse the repository at this point in the history
bump puppeteer to v22.4.1 (HeadlessChrome/122.0.0.0)
  • Loading branch information
macbre authored Mar 10, 2024
2 parents 62bd88e + 633bfd1 commit d18d4da
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 99 deletions.
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

0 comments on commit d18d4da

Please sign in to comment.