How to use the puppeteer-core/lib/FrameManager.Frame function in puppeteer-core

To help you get started, we’ve selected a few puppeteer-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alixaxel / chrome-aws-lambda / source / puppeteer / lib / FrameManager.js View on Github external
let Super = null;

try {
  Super = require('puppeteer/lib/FrameManager').Frame;
} catch (error) {
  Super = require('puppeteer-core/lib/FrameManager').Frame;
}

Super.prototype.count = function (selector) {
  return this.evaluate(
    (selector) => {
      return document.querySelectorAll(selector).length;
    },
    selector
  );
};

Super.prototype.exists = function (selector) {
  return this.evaluate(
    (selector) => {
      return document.querySelector(selector) !== null;
    },