Socket
Socket
Sign inDemoInstall

puppeteer-core

Package Overview
Dependencies
Maintainers
2
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-core - npm Package Compare versions

Comparing version 5.4.1 to 5.5.0

CHANGELOG.md

18

lib/cjs/puppeteer/common/AriaQueryHandler.js

@@ -54,4 +54,11 @@ "use strict";

const waitFor = async (domWorld, selector, options) => {
await addHandlerToWorld(domWorld);
return domWorld.waitForSelectorInPage((_, selector) => globalThis.ariaQuerySelector(selector), selector, options);
const binding = {
name: 'ariaQuerySelector',
pptrFunction: async (selector) => {
const document = await domWorld._document();
const element = await queryOne(document, selector);
return element;
},
};
return domWorld.waitForSelectorInPage((_, selector) => globalThis.ariaQuerySelector(selector), selector, options, binding);
};

@@ -70,9 +77,2 @@ const queryAll = async (element, selector) => {

};
async function addHandlerToWorld(domWorld) {
await domWorld.addBinding('ariaQuerySelector', async (selector) => {
const document = await domWorld._document();
const element = await queryOne(document, selector);
return element;
});
}
/**

@@ -79,0 +79,0 @@ * @internal

@@ -35,2 +35,9 @@ /**

*/
export interface PageBinding {
name: string;
pptrFunction: Function;
}
/**
* @internal
*/
export declare class DOMWorld {

@@ -45,7 +52,12 @@ private _frameManager;

/**
* internal
* @internal
*/
_waitTasks: Set<WaitTask>;
private _boundFunctions;
/**
* @internal
* Contains mapping from functions that should be bound to Puppeteer functions.
*/
_boundFunctions: Map<string, Function>;
private _ctxBindings;
private static bindingIdentifier;
constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings);

@@ -117,7 +129,3 @@ frame(): Frame;

*/
addBindingToContext(name: string): any;
/**
* @internal
*/
addBinding(name: string, puppeteerFunction: Function): Promise<void>;
addBindingToContext(context: ExecutionContext, name: string): Promise<void>;
private _onBindingCalled;

@@ -127,3 +135,3 @@ /**

*/
waitForSelectorInPage(queryOne: Function, selector: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;
waitForSelectorInPage(queryOne: Function, selector: string, options: WaitForSelectorOptions, binding?: PageBinding): Promise<ElementHandle | null>;
waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;

@@ -139,2 +147,14 @@ waitForFunction(pageFunction: Function | string, options?: {

*/
export interface WaitTaskOptions {
domWorld: DOMWorld;
predicateBody: Function | string;
title: string;
polling: string | number;
timeout: number;
binding?: PageBinding;
args: SerializableOrJSHandle[];
}
/**
* @internal
*/
export declare class WaitTask {

@@ -146,2 +166,3 @@ _domWorld: DOMWorld;

_args: SerializableOrJSHandle[];
_binding: PageBinding;
_runCount: number;

@@ -153,3 +174,3 @@ promise: Promise<JSHandle>;

_terminated: boolean;
constructor(domWorld: DOMWorld, predicateBody: Function | string, title: string, polling: string | number, timeout: number, ...args: SerializableOrJSHandle[]);
constructor(options: WaitTaskOptions);
terminate(error: Error): void;

@@ -156,0 +177,0 @@ rerun(): Promise<void>;

@@ -35,6 +35,9 @@ "use strict";

/**
* internal
* @internal
*/
this._waitTasks = new Set();
// Contains mapping from functions that should be bound to Puppeteer functions.
/**
* @internal
* Contains mapping from functions that should be bound to Puppeteer functions.
*/
this._boundFunctions = new Map();

@@ -59,6 +62,2 @@ // Set of bindings that have been registered in the current context.

this._contextResolveCallback = null;
this._ctxBindings.clear();
for (const name of this._boundFunctions.keys()) {
await this.addBindingToContext(name);
}
for (const waitTask of this._waitTasks)

@@ -320,10 +319,11 @@ waitTask.rerun();

*/
async addBindingToContext(name) {
async addBindingToContext(context, name) {
// Previous operation added the binding so we are done.
if (this._ctxBindings.has(name))
if (this._ctxBindings.has(DOMWorld.bindingIdentifier(name, context._contextId))) {
return;
}
// Wait for other operation to finish
if (this._settingUpBinding) {
await this._settingUpBinding;
return this.addBindingToContext(name);
return this.addBindingToContext(context, name);
}

@@ -333,3 +333,2 @@ const bind = async (name) => {

try {
const context = await this.executionContext();
await context._client.send('Runtime.addBinding', {

@@ -348,4 +347,3 @@ name,

if (ctxDestroyed || ctxNotFound) {
// Retry adding the binding in the next context
await bind(name);
return;
}

@@ -357,3 +355,3 @@ else {

}
this._ctxBindings.add(name);
this._ctxBindings.add(DOMWorld.bindingIdentifier(name, context._contextId));
};

@@ -364,11 +362,7 @@ this._settingUpBinding = bind(name);

}
/**
* @internal
*/
async addBinding(name, puppeteerFunction) {
this._boundFunctions.set(name, puppeteerFunction);
await this.addBindingToContext(name);
}
async _onBindingCalled(event) {
let payload;
if (!this._hasContext())
return;
const context = await this.executionContext();
try {

@@ -383,7 +377,5 @@ payload = JSON.parse(event.payload);

const { type, name, seq, args } = payload;
if (type !== 'internal' || !this._ctxBindings.has(name))
if (type !== 'internal' ||
!this._ctxBindings.has(DOMWorld.bindingIdentifier(name, context._contextId)))
return;
if (!this._hasContext())
return;
const context = await this.executionContext();
if (context._contextId !== event.executionContextId)

@@ -413,3 +405,3 @@ return;

*/
async waitForSelectorInPage(queryOne, selector, options) {
async waitForSelectorInPage(queryOne, selector, options, binding) {
const { visible: waitForVisible = false, hidden: waitForHidden = false, timeout = this._timeoutSettings.timeout(), } = options;

@@ -424,3 +416,12 @@ const polling = waitForVisible || waitForHidden ? 'raf' : 'mutation';

}
const waitTask = new WaitTask(this, helper_js_1.helper.makePredicateString(predicate, queryOne), title, polling, timeout, selector, waitForVisible, waitForHidden);
const waitTaskOptions = {
domWorld: this,
predicateBody: helper_js_1.helper.makePredicateString(predicate, queryOne),
title,
polling,
timeout,
args: [selector, waitForVisible, waitForHidden],
binding,
};
const waitTask = new WaitTask(waitTaskOptions);
const jsHandle = await waitTask.promise;

@@ -442,3 +443,11 @@ const elementHandle = jsHandle.asElement();

}
const waitTask = new WaitTask(this, helper_js_1.helper.makePredicateString(predicate), title, polling, timeout, xpath, waitForVisible, waitForHidden);
const waitTaskOptions = {
domWorld: this,
predicateBody: helper_js_1.helper.makePredicateString(predicate),
title,
polling,
timeout,
args: [xpath, waitForVisible, waitForHidden],
};
const waitTask = new WaitTask(waitTaskOptions);
const jsHandle = await waitTask.promise;

@@ -454,3 +463,12 @@ const elementHandle = jsHandle.asElement();

const { polling = 'raf', timeout = this._timeoutSettings.timeout(), } = options;
return new WaitTask(this, pageFunction, 'function', polling, timeout, ...args).promise;
const waitTaskOptions = {
domWorld: this,
predicateBody: pageFunction,
title: 'function',
polling,
timeout,
args,
};
const waitTask = new WaitTask(waitTaskOptions);
return waitTask.promise;
}

@@ -462,2 +480,3 @@ async title() {

exports.DOMWorld = DOMWorld;
DOMWorld.bindingIdentifier = (name, contextId) => `${name}_${contextId}`;
/**

@@ -467,11 +486,11 @@ * @internal

class WaitTask {
constructor(domWorld, predicateBody, title, polling, timeout, ...args) {
constructor(options) {
this._runCount = 0;
this._terminated = false;
if (helper_js_1.helper.isString(polling))
assert_js_1.assert(polling === 'raf' || polling === 'mutation', 'Unknown polling option: ' + polling);
else if (helper_js_1.helper.isNumber(polling))
assert_js_1.assert(polling > 0, 'Cannot poll with non-positive interval: ' + polling);
if (helper_js_1.helper.isString(options.polling))
assert_js_1.assert(options.polling === 'raf' || options.polling === 'mutation', 'Unknown polling option: ' + options.polling);
else if (helper_js_1.helper.isNumber(options.polling))
assert_js_1.assert(options.polling > 0, 'Cannot poll with non-positive interval: ' + options.polling);
else
throw new Error('Unknown polling options: ' + polling);
throw new Error('Unknown polling options: ' + options.polling);
function getPredicateBody(predicateBody) {

@@ -482,9 +501,13 @@ if (helper_js_1.helper.isString(predicateBody))

}
this._domWorld = domWorld;
this._polling = polling;
this._timeout = timeout;
this._predicateBody = getPredicateBody(predicateBody);
this._args = args;
this._domWorld = options.domWorld;
this._polling = options.polling;
this._timeout = options.timeout;
this._predicateBody = getPredicateBody(options.predicateBody);
this._args = options.args;
this._binding = options.binding;
this._runCount = 0;
domWorld._waitTasks.add(this);
this._domWorld._waitTasks.add(this);
if (this._binding) {
this._domWorld._boundFunctions.set(this._binding.name, this._binding.pptrFunction);
}
this.promise = new Promise((resolve, reject) => {

@@ -496,5 +519,5 @@ this._resolve = resolve;

// timeout on our end.
if (timeout) {
const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${title} failed: timeout ${timeout}ms exceeded`);
this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout);
if (options.timeout) {
const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), options.timeout);
}

@@ -510,7 +533,14 @@ this.rerun();

const runCount = ++this._runCount;
/** @type {?JSHandle} */
let success = null;
let error = null;
const context = await this._domWorld.executionContext();
if (this._terminated || runCount !== this._runCount)
return;
if (this._binding) {
await this._domWorld.addBindingToContext(context, this._binding.name);
}
if (this._terminated || runCount !== this._runCount)
return;
try {
success = await (await this._domWorld.executionContext()).evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args);
success = await context.evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args);
}

@@ -533,6 +563,9 @@ catch (error_) {

}
// When frame is detached the task should have been terminated by the DOMWorld.
// This can fail if we were adding this task while the frame was detached,
// so we terminate here instead.
if (error) {
if (error.message.includes('TypeError: binding is not a function')) {
return this.rerun();
}
// When frame is detached the task should have been terminated by the DOMWorld.
// This can fail if we were adding this task while the frame was detached,
// so we terminate here instead.
if (error.message.includes('Execution context is not available in detached frame')) {

@@ -539,0 +572,0 @@ this.terminate(new Error('waitForFunction failed: frame got detached.'));

@@ -456,9 +456,2 @@ "use strict";

async tap(x, y) {
// Touches appear to be lost during the first frame after navigation.
// This waits a frame before sending the tap.
// @see https://crbug.com/613219
await this._client.send('Runtime.evaluate', {
expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',
awaitPromise: true,
});
const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];

@@ -465,0 +458,0 @@ await this._client.send('Input.dispatchTouchEvent', {

@@ -44,3 +44,3 @@ /**

*/
_isClosedPromise: Promise<boolean>;
_isClosedPromise: Promise<void>;
/**

@@ -47,0 +47,0 @@ * @internal

@@ -19,4 +19,2 @@ "use strict";

exports.isNode = void 0;
exports.isNode = !!(typeof process !== 'undefined' &&
process.versions &&
process.versions.node);
exports.isNode = !!(typeof process !== 'undefined' && process.version);

@@ -20,4 +20,4 @@ "use strict";

exports.PUPPETEER_REVISIONS = {
chromium: '809590',
chromium: '818858',
firefox: 'latest',
};

@@ -51,4 +51,11 @@ /**

const waitFor = async (domWorld, selector, options) => {
await addHandlerToWorld(domWorld);
return domWorld.waitForSelectorInPage((_, selector) => globalThis.ariaQuerySelector(selector), selector, options);
const binding = {
name: 'ariaQuerySelector',
pptrFunction: async (selector) => {
const document = await domWorld._document();
const element = await queryOne(document, selector);
return element;
},
};
return domWorld.waitForSelectorInPage((_, selector) => globalThis.ariaQuerySelector(selector), selector, options, binding);
};

@@ -67,9 +74,2 @@ const queryAll = async (element, selector) => {

};
async function addHandlerToWorld(domWorld) {
await domWorld.addBinding('ariaQuerySelector', async (selector) => {
const document = await domWorld._document();
const element = await queryOne(document, selector);
return element;
});
}
/**

@@ -76,0 +76,0 @@ * @internal

@@ -35,2 +35,9 @@ /**

*/
export interface PageBinding {
name: string;
pptrFunction: Function;
}
/**
* @internal
*/
export declare class DOMWorld {

@@ -45,7 +52,12 @@ private _frameManager;

/**
* internal
* @internal
*/
_waitTasks: Set<WaitTask>;
private _boundFunctions;
/**
* @internal
* Contains mapping from functions that should be bound to Puppeteer functions.
*/
_boundFunctions: Map<string, Function>;
private _ctxBindings;
private static bindingIdentifier;
constructor(frameManager: FrameManager, frame: Frame, timeoutSettings: TimeoutSettings);

@@ -117,7 +129,3 @@ frame(): Frame;

*/
addBindingToContext(name: string): any;
/**
* @internal
*/
addBinding(name: string, puppeteerFunction: Function): Promise<void>;
addBindingToContext(context: ExecutionContext, name: string): Promise<void>;
private _onBindingCalled;

@@ -127,3 +135,3 @@ /**

*/
waitForSelectorInPage(queryOne: Function, selector: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;
waitForSelectorInPage(queryOne: Function, selector: string, options: WaitForSelectorOptions, binding?: PageBinding): Promise<ElementHandle | null>;
waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;

@@ -139,2 +147,14 @@ waitForFunction(pageFunction: Function | string, options?: {

*/
export interface WaitTaskOptions {
domWorld: DOMWorld;
predicateBody: Function | string;
title: string;
polling: string | number;
timeout: number;
binding?: PageBinding;
args: SerializableOrJSHandle[];
}
/**
* @internal
*/
export declare class WaitTask {

@@ -146,2 +166,3 @@ _domWorld: DOMWorld;

_args: SerializableOrJSHandle[];
_binding: PageBinding;
_runCount: number;

@@ -153,3 +174,3 @@ promise: Promise<JSHandle>;

_terminated: boolean;
constructor(domWorld: DOMWorld, predicateBody: Function | string, title: string, polling: string | number, timeout: number, ...args: SerializableOrJSHandle[]);
constructor(options: WaitTaskOptions);
terminate(error: Error): void;

@@ -156,0 +177,0 @@ rerun(): Promise<void>;

@@ -32,6 +32,9 @@ /**

/**
* internal
* @internal
*/
this._waitTasks = new Set();
// Contains mapping from functions that should be bound to Puppeteer functions.
/**
* @internal
* Contains mapping from functions that should be bound to Puppeteer functions.
*/
this._boundFunctions = new Map();

@@ -56,6 +59,2 @@ // Set of bindings that have been registered in the current context.

this._contextResolveCallback = null;
this._ctxBindings.clear();
for (const name of this._boundFunctions.keys()) {
await this.addBindingToContext(name);
}
for (const waitTask of this._waitTasks)

@@ -317,10 +316,11 @@ waitTask.rerun();

*/
async addBindingToContext(name) {
async addBindingToContext(context, name) {
// Previous operation added the binding so we are done.
if (this._ctxBindings.has(name))
if (this._ctxBindings.has(DOMWorld.bindingIdentifier(name, context._contextId))) {
return;
}
// Wait for other operation to finish
if (this._settingUpBinding) {
await this._settingUpBinding;
return this.addBindingToContext(name);
return this.addBindingToContext(context, name);
}

@@ -330,3 +330,2 @@ const bind = async (name) => {

try {
const context = await this.executionContext();
await context._client.send('Runtime.addBinding', {

@@ -345,4 +344,3 @@ name,

if (ctxDestroyed || ctxNotFound) {
// Retry adding the binding in the next context
await bind(name);
return;
}

@@ -354,3 +352,3 @@ else {

}
this._ctxBindings.add(name);
this._ctxBindings.add(DOMWorld.bindingIdentifier(name, context._contextId));
};

@@ -361,11 +359,7 @@ this._settingUpBinding = bind(name);

}
/**
* @internal
*/
async addBinding(name, puppeteerFunction) {
this._boundFunctions.set(name, puppeteerFunction);
await this.addBindingToContext(name);
}
async _onBindingCalled(event) {
let payload;
if (!this._hasContext())
return;
const context = await this.executionContext();
try {

@@ -380,7 +374,5 @@ payload = JSON.parse(event.payload);

const { type, name, seq, args } = payload;
if (type !== 'internal' || !this._ctxBindings.has(name))
if (type !== 'internal' ||
!this._ctxBindings.has(DOMWorld.bindingIdentifier(name, context._contextId)))
return;
if (!this._hasContext())
return;
const context = await this.executionContext();
if (context._contextId !== event.executionContextId)

@@ -410,3 +402,3 @@ return;

*/
async waitForSelectorInPage(queryOne, selector, options) {
async waitForSelectorInPage(queryOne, selector, options, binding) {
const { visible: waitForVisible = false, hidden: waitForHidden = false, timeout = this._timeoutSettings.timeout(), } = options;

@@ -421,3 +413,12 @@ const polling = waitForVisible || waitForHidden ? 'raf' : 'mutation';

}
const waitTask = new WaitTask(this, helper.makePredicateString(predicate, queryOne), title, polling, timeout, selector, waitForVisible, waitForHidden);
const waitTaskOptions = {
domWorld: this,
predicateBody: helper.makePredicateString(predicate, queryOne),
title,
polling,
timeout,
args: [selector, waitForVisible, waitForHidden],
binding,
};
const waitTask = new WaitTask(waitTaskOptions);
const jsHandle = await waitTask.promise;

@@ -439,3 +440,11 @@ const elementHandle = jsHandle.asElement();

}
const waitTask = new WaitTask(this, helper.makePredicateString(predicate), title, polling, timeout, xpath, waitForVisible, waitForHidden);
const waitTaskOptions = {
domWorld: this,
predicateBody: helper.makePredicateString(predicate),
title,
polling,
timeout,
args: [xpath, waitForVisible, waitForHidden],
};
const waitTask = new WaitTask(waitTaskOptions);
const jsHandle = await waitTask.promise;

@@ -451,3 +460,12 @@ const elementHandle = jsHandle.asElement();

const { polling = 'raf', timeout = this._timeoutSettings.timeout(), } = options;
return new WaitTask(this, pageFunction, 'function', polling, timeout, ...args).promise;
const waitTaskOptions = {
domWorld: this,
predicateBody: pageFunction,
title: 'function',
polling,
timeout,
args,
};
const waitTask = new WaitTask(waitTaskOptions);
return waitTask.promise;
}

@@ -458,2 +476,3 @@ async title() {

}
DOMWorld.bindingIdentifier = (name, contextId) => `${name}_${contextId}`;
/**

@@ -463,11 +482,11 @@ * @internal

export class WaitTask {
constructor(domWorld, predicateBody, title, polling, timeout, ...args) {
constructor(options) {
this._runCount = 0;
this._terminated = false;
if (helper.isString(polling))
assert(polling === 'raf' || polling === 'mutation', 'Unknown polling option: ' + polling);
else if (helper.isNumber(polling))
assert(polling > 0, 'Cannot poll with non-positive interval: ' + polling);
if (helper.isString(options.polling))
assert(options.polling === 'raf' || options.polling === 'mutation', 'Unknown polling option: ' + options.polling);
else if (helper.isNumber(options.polling))
assert(options.polling > 0, 'Cannot poll with non-positive interval: ' + options.polling);
else
throw new Error('Unknown polling options: ' + polling);
throw new Error('Unknown polling options: ' + options.polling);
function getPredicateBody(predicateBody) {

@@ -478,9 +497,13 @@ if (helper.isString(predicateBody))

}
this._domWorld = domWorld;
this._polling = polling;
this._timeout = timeout;
this._predicateBody = getPredicateBody(predicateBody);
this._args = args;
this._domWorld = options.domWorld;
this._polling = options.polling;
this._timeout = options.timeout;
this._predicateBody = getPredicateBody(options.predicateBody);
this._args = options.args;
this._binding = options.binding;
this._runCount = 0;
domWorld._waitTasks.add(this);
this._domWorld._waitTasks.add(this);
if (this._binding) {
this._domWorld._boundFunctions.set(this._binding.name, this._binding.pptrFunction);
}
this.promise = new Promise((resolve, reject) => {

@@ -492,5 +515,5 @@ this._resolve = resolve;

// timeout on our end.
if (timeout) {
const timeoutError = new TimeoutError(`waiting for ${title} failed: timeout ${timeout}ms exceeded`);
this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout);
if (options.timeout) {
const timeoutError = new TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), options.timeout);
}

@@ -506,7 +529,14 @@ this.rerun();

const runCount = ++this._runCount;
/** @type {?JSHandle} */
let success = null;
let error = null;
const context = await this._domWorld.executionContext();
if (this._terminated || runCount !== this._runCount)
return;
if (this._binding) {
await this._domWorld.addBindingToContext(context, this._binding.name);
}
if (this._terminated || runCount !== this._runCount)
return;
try {
success = await (await this._domWorld.executionContext()).evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args);
success = await context.evaluateHandle(waitForPredicatePageFunction, this._predicateBody, this._polling, this._timeout, ...this._args);
}

@@ -529,6 +559,9 @@ catch (error_) {

}
// When frame is detached the task should have been terminated by the DOMWorld.
// This can fail if we were adding this task while the frame was detached,
// so we terminate here instead.
if (error) {
if (error.message.includes('TypeError: binding is not a function')) {
return this.rerun();
}
// When frame is detached the task should have been terminated by the DOMWorld.
// This can fail if we were adding this task while the frame was detached,
// so we terminate here instead.
if (error.message.includes('Execution context is not available in detached frame')) {

@@ -535,0 +568,0 @@ this.terminate(new Error('waitForFunction failed: frame got detached.'));

@@ -451,9 +451,2 @@ /**

async tap(x, y) {
// Touches appear to be lost during the first frame after navigation.
// This waits a frame before sending the tap.
// @see https://crbug.com/613219
await this._client.send('Runtime.evaluate', {
expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',
awaitPromise: true,
});
const touchPoints = [{ x: Math.round(x), y: Math.round(y) }];

@@ -460,0 +453,0 @@ await this._client.send('Input.dispatchTouchEvent', {

@@ -44,3 +44,3 @@ /**

*/
_isClosedPromise: Promise<boolean>;
_isClosedPromise: Promise<void>;
/**

@@ -47,0 +47,0 @@ * @internal

@@ -16,4 +16,2 @@ /**

*/
export const isNode = !!(typeof process !== 'undefined' &&
process.versions &&
process.versions.node);
export const isNode = !!(typeof process !== 'undefined' && process.version);

@@ -17,4 +17,4 @@ /**

export const PUPPETEER_REVISIONS = {
chromium: '809590',
chromium: '818858',
firefox: 'latest',
};
{
"name": "puppeteer-core",
"version": "5.4.1",
"version": "5.5.0",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",

@@ -35,4 +35,4 @@ "main": "./cjs-entry-core.js",

"generate-docs": "npm run tsc && api-extractor run --local --verbose && api-documenter markdown -i temp -o new-docs",
"generate-dependency-graph": "echo 'Requires graphviz installed locally!' && depcruise --exclude 'api.ts' --do-not-follow '^node_modules' --output-type dot src/index.ts | dot -T png > dependency-chart.png",
"ensure-correct-devtools-protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package"
"ensure-correct-devtools-protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package",
"release": "standard-version"
},

@@ -50,3 +50,3 @@ "files": [

"debug": "^4.1.0",
"devtools-protocol": "0.0.809251",
"devtools-protocol": "0.0.818844",
"extract-zip": "^2.0.0",

@@ -82,3 +82,2 @@ "https-proxy-agent": "^4.0.0",

"cross-env": "^7.0.2",
"dependency-cruiser": "^9.7.0",
"eslint": "^7.10.0",

@@ -102,2 +101,3 @@ "eslint-config-prettier": "^6.12.0",

"sinon": "^9.0.2",
"standard-version": "^9.0.0",
"text-diff": "^1.0.1",

@@ -111,3 +111,9 @@ "ts-node": "^9.0.0",

}
},
"standard-version": {
"skip": {
"commit": true,
"tag": true
}
}
}

@@ -9,3 +9,3 @@ # Puppeteer

###### [API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md)
###### [API](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/puppeteer/puppeteer/blob/main/CONTRIBUTING.md) | [Troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md)

@@ -41,3 +41,3 @@ > Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.

Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#environment-variables).
Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, or to download a different browser, see [Environment variables](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#environment-variables).

@@ -68,3 +68,3 @@

Puppeteer will be familiar to people using other browser testing frameworks. You create an instance
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#).
of `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#).

@@ -94,3 +94,3 @@ **Example** - navigating to https://example.com and saving a screenshot as *example.png*:

Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagesetviewportviewport).
Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagesetviewportviewport).

@@ -120,3 +120,3 @@ **Example** - create a PDF.

See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.
See [`Page.pdf()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.

@@ -156,3 +156,3 @@ **Example** - evaluate script in the context of the page

See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.
See [`Page.evaluate()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.

@@ -166,3 +166,3 @@ <!-- [END getstarted] -->

Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:
Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless` option](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:

@@ -183,3 +183,3 @@ ```js

You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) for more information.
You can also use Puppeteer with Firefox Nightly (experimental support). See [`Puppeteer.launch()`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) for more information.

@@ -196,3 +196,3 @@ See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.

- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md)
- [API Documentation](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md)
- [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples/)

@@ -340,3 +340,3 @@ - [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)

From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.

@@ -437,3 +437,3 @@ We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari.

* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.4.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)
* Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/puppeteer/puppeteer/blob/v5.5.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)
* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).

@@ -440,0 +440,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc