asdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
const { startFlow } = require('lighthouse/lighthouse-core/fraggle-rock/api.js'); | |
const fs = require("fs"); | |
(async () => { | |
const browser = await puppeteer.launch({ headless: false }); | |
const page = await browser.newPage(); | |
const flow = await startFlow(page, { | |
name: 'Go to homepage', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
async function waitForSelectors(selectors, frame) { | |
for (const selector of selectors) { | |
try { | |
return await waitForSelector(selector, frame); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var waitFor = async function waitFor(conditionFn, { timeout = 15000, checkInterval = 25, debugString = null, } = {}) { | |
if (typeof conditionFn !== "function") { | |
throw Error("waitFor condition argument isn't a function. Did you mean waitForElement?"); | |
} | |
if (!debugString) { | |
debugString = conditionFn.toString(); | |
} | |
let startedAt = new Date(); | |
let conditionResult = await conditionFn(); | |
while (!conditionResult) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; | |
clearTimeout(timeout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function throttle (callback, limit) { | |
var wait = false; | |
return function () { | |
if (!wait) { | |
callback.apply(null, arguments); | |
wait = true; | |
setTimeout(function () { | |
wait = false; | |
}, limit); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- |
See below.
See below.
NewerOlder