brave-real-puppeteer-core 24.22.0 → 24.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/advanced-stealth.js +1 -1
- package/lib/cjs/puppeteer/api/Dialog.d.ts +8 -10
- package/lib/cjs/puppeteer/api/Dialog.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Dialog.js +8 -10
- package/lib/cjs/puppeteer/api/Dialog.js.map +1 -1
- package/lib/cjs/puppeteer/api/ElementHandle.d.ts +28 -30
- package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/ElementHandle.js +27 -29
- package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/cjs/puppeteer/api/Frame.d.ts +34 -38
- package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Frame.js +34 -38
- package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/api/HTTPRequest.d.ts +8 -1
- package/lib/cjs/puppeteer/api/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/HTTPRequest.js +12 -14
- package/lib/cjs/puppeteer/api/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/api/Page.d.ts +92 -108
- package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Page.js +33 -39
- package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Browser.js +5 -3
- package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
- package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +4 -2
- package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js +14 -5
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
- package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Page.js +12 -6
- package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Browser.js +24 -2
- package/lib/cjs/puppeteer/bidi/core/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js +3 -0
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.d.ts +13 -22
- package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.js +13 -22
- package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.js.map +1 -1
- package/lib/cjs/puppeteer/common/Device.d.ts +6 -8
- package/lib/cjs/puppeteer/common/Device.d.ts.map +1 -1
- package/lib/cjs/puppeteer/common/Device.js +6 -8
- package/lib/cjs/puppeteer/common/Device.js.map +1 -1
- package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
- package/lib/cjs/puppeteer/generated/injected.js +1 -1
- package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
- package/lib/cjs/puppeteer/generated/version.js +1 -1
- package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.js +7 -4
- package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
- package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/lib/cjs/puppeteer/node/PipeTransport.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/PipeTransport.js +15 -16
- package/lib/cjs/puppeteer/node/PipeTransport.js.map +1 -1
- package/lib/cjs/puppeteer/node/PuppeteerNode.d.ts +5 -7
- package/lib/cjs/puppeteer/node/PuppeteerNode.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/PuppeteerNode.js +5 -7
- package/lib/cjs/puppeteer/node/PuppeteerNode.js.map +1 -1
- package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/lib/cjs/puppeteer/revisions.js +3 -3
- package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/lib/cjs/puppeteer/util/Function.d.ts.map +1 -1
- package/lib/cjs/puppeteer/util/Function.js +16 -25
- package/lib/cjs/puppeteer/util/Function.js.map +1 -1
- package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/lib/es5-iife/puppeteer-core-browser.d.ts +189 -225
- package/lib/es5-iife/puppeteer-core-browser.js +155 -190
- package/lib/esm/puppeteer/api/Dialog.d.ts +8 -10
- package/lib/esm/puppeteer/api/Dialog.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Dialog.js +8 -10
- package/lib/esm/puppeteer/api/Dialog.js.map +1 -1
- package/lib/esm/puppeteer/api/ElementHandle.d.ts +28 -30
- package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/ElementHandle.js +27 -29
- package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/esm/puppeteer/api/Frame.d.ts +34 -38
- package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Frame.js +34 -38
- package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/lib/esm/puppeteer/api/HTTPRequest.d.ts +8 -1
- package/lib/esm/puppeteer/api/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/HTTPRequest.js +12 -14
- package/lib/esm/puppeteer/api/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/api/Page.d.ts +92 -108
- package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Page.js +33 -39
- package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Browser.js +5 -3
- package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Frame.js +1 -1
- package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +4 -2
- package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.js +15 -6
- package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
- package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Page.js +12 -6
- package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Browser.js +24 -2
- package/lib/esm/puppeteer/bidi/core/Browser.js.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.js +3 -0
- package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.d.ts +13 -22
- package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.js +13 -22
- package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.js.map +1 -1
- package/lib/esm/puppeteer/common/Device.d.ts +6 -8
- package/lib/esm/puppeteer/common/Device.d.ts.map +1 -1
- package/lib/esm/puppeteer/common/Device.js +6 -8
- package/lib/esm/puppeteer/common/Device.js.map +1 -1
- package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
- package/lib/esm/puppeteer/generated/injected.js +1 -1
- package/lib/esm/puppeteer/generated/version.d.ts +1 -1
- package/lib/esm/puppeteer/generated/version.js +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.js +7 -4
- package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
- package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/lib/esm/puppeteer/node/PipeTransport.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/PipeTransport.js +15 -16
- package/lib/esm/puppeteer/node/PipeTransport.js.map +1 -1
- package/lib/esm/puppeteer/node/PuppeteerNode.d.ts +5 -7
- package/lib/esm/puppeteer/node/PuppeteerNode.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/PuppeteerNode.js +5 -7
- package/lib/esm/puppeteer/node/PuppeteerNode.js.map +1 -1
- package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/lib/esm/puppeteer/revisions.js +3 -3
- package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/lib/esm/puppeteer/util/Function.d.ts.map +1 -1
- package/lib/esm/puppeteer/util/Function.js +16 -25
- package/lib/esm/puppeteer/util/Function.js.map +1 -1
- package/lib/types.d.ts +189 -225
- package/package.json +14 -14
- package/src/api/Dialog.ts +8 -10
- package/src/api/ElementHandle.ts +27 -29
- package/src/api/Frame.ts +34 -38
- package/src/api/HTTPRequest.ts +17 -14
- package/src/api/Page.ts +92 -108
- package/src/bidi/Browser.ts +5 -3
- package/src/bidi/Frame.ts +5 -1
- package/src/bidi/HTTPRequest.ts +28 -3
- package/src/bidi/Page.ts +16 -7
- package/src/bidi/core/Browser.ts +28 -2
- package/src/cdp/HTTPRequest.ts +4 -0
- package/src/cdp/PredefinedNetworkConditions.ts +13 -22
- package/src/common/Device.ts +6 -8
- package/src/generated/injected.ts +1 -1
- package/src/generated/version.ts +1 -1
- package/src/node/BrowserLauncher.ts +7 -4
- package/src/node/ChromeLauncher.ts +1 -0
- package/src/node/PipeTransport.ts +15 -17
- package/src/node/PuppeteerNode.ts +5 -7
- package/src/revisions.ts +3 -3
- package/src/util/Function.ts +22 -30
|
@@ -2965,7 +2965,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
2965
2965
|
/**
|
|
2966
2966
|
* @internal
|
|
2967
2967
|
*/
|
|
2968
|
-
const packageVersion = '24.
|
|
2968
|
+
const packageVersion = '24.23.0';
|
|
2969
2969
|
|
|
2970
2970
|
/**
|
|
2971
2971
|
* @license
|
|
@@ -4332,16 +4332,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
4332
4332
|
* ```ts
|
|
4333
4333
|
* import puppeteer from 'puppeteer';
|
|
4334
4334
|
*
|
|
4335
|
-
*
|
|
4336
|
-
*
|
|
4337
|
-
*
|
|
4338
|
-
*
|
|
4339
|
-
*
|
|
4340
|
-
*
|
|
4341
|
-
*
|
|
4342
|
-
*
|
|
4343
|
-
* page.evaluate(() => alert('1'));
|
|
4344
|
-
* })();
|
|
4335
|
+
* const browser = await puppeteer.launch();
|
|
4336
|
+
* const page = await browser.newPage();
|
|
4337
|
+
* page.on('dialog', async dialog => {
|
|
4338
|
+
* console.log(dialog.message());
|
|
4339
|
+
* await dialog.dismiss();
|
|
4340
|
+
* await browser.close();
|
|
4341
|
+
* });
|
|
4342
|
+
* await page.evaluate(() => alert('1'));
|
|
4345
4343
|
* ```
|
|
4346
4344
|
*
|
|
4347
4345
|
* @public
|
|
@@ -4513,30 +4511,21 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
4513
4511
|
*/
|
|
4514
4512
|
function stringifyFunction(fn) {
|
|
4515
4513
|
let value = fn.toString();
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
} catch (err) {
|
|
4519
|
-
if (err.message.includes(`Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive`) || err.message.includes('Evaluating a string as JavaScript violates the following Content Security Policy')) {
|
|
4520
|
-
// The content security policy does not allow Function eval. Let's
|
|
4521
|
-
// assume the value might be valid as is.
|
|
4522
|
-
return value;
|
|
4523
|
-
}
|
|
4524
|
-
// This means we might have a function shorthand (e.g. `test(){}`). Let's
|
|
4525
|
-
// try prefixing.
|
|
4526
|
-
let prefix = 'function ';
|
|
4527
|
-
if (value.startsWith('async ')) {
|
|
4528
|
-
prefix = `async ${prefix}`;
|
|
4529
|
-
value = value.substring('async '.length);
|
|
4530
|
-
}
|
|
4531
|
-
value = `${prefix}${value}`;
|
|
4532
|
-
try {
|
|
4533
|
-
// stripped
|
|
4534
|
-
} catch {
|
|
4535
|
-
// We tried hard to serialize, but there's a weird beast here.
|
|
4536
|
-
throw new Error('Passed function cannot be serialized!');
|
|
4537
|
-
}
|
|
4514
|
+
if (value.match(/^(async )*function(\(|\s)/) || value.match(/^(async )*function\s*\*\s*/)) {
|
|
4515
|
+
return value;
|
|
4538
4516
|
}
|
|
4539
|
-
|
|
4517
|
+
const isArrow = value.startsWith('(') || value.match(/^async\s*\(/) || value.match(/^(async)*\s*(?:[$_\p{ID_Start}])(?:[$\u200C\u200D\p{ID_Continue}])*\s*=>/u);
|
|
4518
|
+
if (isArrow) {
|
|
4519
|
+
return value;
|
|
4520
|
+
}
|
|
4521
|
+
// This means we might have a function shorthand (e.g. `test(){}`). Let's
|
|
4522
|
+
// try prefixing.
|
|
4523
|
+
let prefix = 'function ';
|
|
4524
|
+
if (value.startsWith('async ')) {
|
|
4525
|
+
prefix = `async ${prefix}`;
|
|
4526
|
+
value = value.substring('async '.length);
|
|
4527
|
+
}
|
|
4528
|
+
return `${prefix}${value}`;
|
|
4540
4529
|
}
|
|
4541
4530
|
/**
|
|
4542
4531
|
* Replaces `PLACEHOLDER`s with the given replacements.
|
|
@@ -5077,7 +5066,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
5077
5066
|
}) => {
|
|
5078
5067
|
return cssQuerySelectorAll(element, selector);
|
|
5079
5068
|
});
|
|
5080
|
-
const source = "\"use strict\";var g=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var
|
|
5069
|
+
const source = "\"use strict\";var g=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,o)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let s of B(e))!Y.call(t,s)&&s!==r&&g(t,s,{get:()=>e[s],enumerable:!(o=X(e,s))||o.enumerable});return t};var J=t=>G(g({},\"__esModule\",{value:!0}),t);var pe={};l(pe,{default:()=>he});module.exports=J(pe);var N=class extends Error{constructor(e,r){super(e,r),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},p=class extends N{};var c=class t{static create(e){return new t(e)}static async race(e){let r=new Set;try{let o=e.map(s=>s instanceof t?(s.#s&&r.add(s),s.valueOrThrow()):s);return await Promise.race(o)}finally{for(let o of r)o.reject(new Error(\"Timeout cleared\"))}}#e=!1;#r=!1;#o;#t;#a=new Promise(e=>{this.#t=e});#s;#i;constructor(e){e&&e.timeout>0&&(this.#i=new p(e.message),this.#s=setTimeout(()=>{this.reject(this.#i)},e.timeout))}#l(e){clearTimeout(this.#s),this.#o=e,this.#t()}resolve(e){this.#r||this.#e||(this.#e=!0,this.#l(e))}reject(e){this.#r||this.#e||(this.#r=!0,this.#l(e))}resolved(){return this.#e}finished(){return this.#e||this.#r}value(){return this.#o}#n;valueOrThrow(){return this.#n||(this.#n=(async()=>{if(await this.#a,this.#r)throw this.#o;return this.#o})()),this.#n}};var L=new Map,W=t=>{let e=L.get(t);return e||(e=new Function(`return ${t}`)(),L.set(t,e),e)};var b={};l(b,{ariaQuerySelector:()=>z,ariaQuerySelectorAll:()=>x});var z=(t,e)=>globalThis.__ariaQuerySelector(t,e),x=async function*(t,e){yield*await globalThis.__ariaQuerySelectorAll(t,e)};var E={};l(E,{cssQuerySelector:()=>K,cssQuerySelectorAll:()=>Z});var K=(t,e)=>t.querySelector(e),Z=function(t,e){return t.querySelectorAll(e)};var A={};l(A,{customQuerySelectors:()=>P});var v=class{#e=new Map;register(e,r){if(!r.queryOne&&r.queryAll){let o=r.queryAll;r.queryOne=(s,i)=>{for(let n of o(s,i))return n;return null}}else if(r.queryOne&&!r.queryAll){let o=r.queryOne;r.queryAll=(s,i)=>{let n=o(s,i);return n?[n]:[]}}else if(!r.queryOne||!r.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:r.queryOne,querySelectorAll:r.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},P=new v;var R={};l(R,{pierceQuerySelector:()=>ee,pierceQuerySelectorAll:()=>te});var ee=(t,e)=>{let r=null,o=s=>{let i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT);do{let n=i.currentNode;n.shadowRoot&&o(n.shadowRoot),!(n instanceof ShadowRoot)&&n!==s&&!r&&n.matches(e)&&(r=n)}while(!r&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r},te=(t,e)=>{let r=[],o=s=>{let i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT);do{let n=i.currentNode;n.shadowRoot&&o(n.shadowRoot),!(n instanceof ShadowRoot)&&n!==s&&n.matches(e)&&r.push(n)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r};var u=(t,e)=>{if(!t)throw new Error(e)};var y=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=new MutationObserver(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())}),this.#o.observe(this.#r,{childList:!0,subtree:!0,attributes:!0})}async stop(){u(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\")),this.#o&&(this.#o.disconnect(),this.#o=void 0)}result(){return u(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},w=class{#e;#r;constructor(e){this.#e=e}async start(){let e=this.#r=c.create(),r=await this.#e();if(r){e.resolve(r);return}let o=async()=>{if(e.finished())return;let s=await this.#e();if(!s){window.requestAnimationFrame(o);return}e.resolve(s),await this.stop()};window.requestAnimationFrame(o)}async stop(){u(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\"))}result(){return u(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},T=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=setInterval(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())},this.#r)}async stop(){u(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\")),this.#o&&(clearInterval(this.#o),this.#o=void 0)}result(){return u(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}};var _={};l(_,{PCombinator:()=>H,pQuerySelector:()=>fe,pQuerySelectorAll:()=>$});var a=class{static async*map(e,r){for await(let o of e)yield await r(o)}static async*flatMap(e,r){for await(let o of e)yield*r(o)}static async collect(e){let r=[];for await(let o of e)r.push(o);return r}static async first(e){for await(let r of e)return r}};var C={};l(C,{textQuerySelectorAll:()=>m});var re=new Set([\"checkbox\",\"image\",\"radio\"]),oe=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!re.has(t.type),se=new Set([\"SCRIPT\",\"STYLE\"]),f=t=>!se.has(t.nodeName)&&!document.head?.contains(t),I=new WeakMap,F=t=>{for(;t;)I.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},j=new WeakSet,ne=new MutationObserver(t=>{for(let e of t)F(e.target)}),d=t=>{let e=I.get(t);if(e||(e={full:\"\",immediate:[]},!f(t)))return e;let r=\"\";if(oe(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",o=>{F(o.target)},{once:!0,capture:!0});else{for(let o=t.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE){e.full+=o.nodeValue??\"\",r+=o.nodeValue??\"\";continue}r&&e.immediate.push(r),r=\"\",o.nodeType===Node.ELEMENT_NODE&&(e.full+=d(o).full)}r&&e.immediate.push(r),t instanceof Element&&t.shadowRoot&&(e.full+=d(t.shadowRoot).full),j.has(t)||(ne.observe(t,{childList:!0,characterData:!0,subtree:!0}),j.add(t))}return I.set(t,e),e};var m=function*(t,e){let r=!1;for(let o of t.childNodes)if(o instanceof Element&&f(o)){let s;o.shadowRoot?s=m(o.shadowRoot,e):s=m(o,e);for(let i of s)yield i,r=!0}r||t instanceof Element&&f(t)&&d(t).full.includes(e)&&(yield t)};var k={};l(k,{checkVisibility:()=>le,pierce:()=>S,pierceAll:()=>O});var ie=[\"hidden\",\"collapse\"],le=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=window.getComputedStyle(r),s=o&&!ie.includes(o.visibility)&&!ae(r);return e===s?t:!1};function ae(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var ce=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*S(t){ce(t)?yield t.shadowRoot:yield t}function*O(t){t=S(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let r of e){let o;for(;o=r.nextNode();)o.shadowRoot&&(yield o.shadowRoot,e.push(document.createTreeWalker(o.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var D={};l(D,{xpathQuerySelectorAll:()=>q});var q=function*(t,e,r=-1){let s=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),i=[],n;for(;(n=s.iterateNext())&&(i.push(n),!(r&&i.length===r)););for(let h=0;h<i.length;h++)n=i[h],yield n,delete i[h]};var ue=/[-\\w\\P{ASCII}*]/u,H=(r=>(r.Descendent=\">>>\",r.Child=\">>>>\",r))(H||{}),V=t=>\"querySelectorAll\"in t,Q=class{#e;#r=[];#o=void 0;elements;constructor(e,r){this.elements=[e],this.#e=r,this.#t()}async run(){if(typeof this.#o==\"string\")switch(this.#o.trimStart()){case\":scope\":this.#t();break}for(;this.#o!==void 0;this.#t()){let e=this.#o;typeof e==\"string\"?e[0]&&ue.test(e[0])?this.elements=a.flatMap(this.elements,async function*(r){V(r)&&(yield*r.querySelectorAll(e))}):this.elements=a.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!V(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let s of r.parentElement.children)if(++o,s===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=a.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*m(r,e.value);break;case\"xpath\":yield*q(r,e.value);break;case\"aria\":yield*x(r,e.value);break;default:let o=P.get(e.name);if(!o)throw new Error(`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#t(){if(this.#r.length!==0){this.#o=this.#r.shift();return}if(this.#e.length===0){this.#o=void 0;return}let e=this.#e.shift();switch(e){case\">>>>\":{this.elements=a.flatMap(this.elements,S),this.#t();break}case\">>>\":{this.elements=a.flatMap(this.elements,O),this.#t();break}default:this.#r=e,this.#t();break}}},M=class{#e=new WeakMap;calculate(e,r=[]){if(e===null)return r;e instanceof ShadowRoot&&(e=e.host);let o=this.#e.get(e);if(o)return[...o,...r];let s=0;for(let n=e.previousSibling;n;n=n.previousSibling)++s;let i=this.calculate(e.parentNode,[s]);return this.#e.set(e,i),[...i,...r]}},U=(t,e)=>{if(t.length+e.length===0)return 0;let[r=-1,...o]=t,[s=-1,...i]=e;return r===s?U(o,i):r<s?-1:1},de=async function*(t){let e=new Set;for await(let o of t)e.add(o);let r=new M;yield*[...e.values()].map(o=>[o,r.calculate(o)]).sort(([,o],[,s])=>U(o,s)).map(([o])=>o)},$=function(t,e){let r=JSON.parse(e);if(r.some(o=>{let s=0;return o.some(i=>(typeof i==\"string\"?++s:s=0,s>1))}))throw new Error(\"Multiple deep combinators found in sequence.\");return de(a.flatMap(r,o=>{let s=new Q(t,o);return s.run(),s.elements}))},fe=async function(t,e){for await(let r of $(t,e))return r;return null};var me=Object.freeze({...b,...A,...R,..._,...C,...k,...D,...E,Deferred:c,createFunction:W,createTextContent:d,IntervalPoller:T,isSuitableNodeForTextMatching:f,MutationPoller:y,RAFPoller:w}),he=me;\n";
|
|
5081
5070
|
|
|
5082
5071
|
/**
|
|
5083
5072
|
* @license
|
|
@@ -7058,19 +7047,18 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
7058
7047
|
* ```ts
|
|
7059
7048
|
* import puppeteer from 'puppeteer';
|
|
7060
7049
|
*
|
|
7061
|
-
*
|
|
7062
|
-
*
|
|
7063
|
-
*
|
|
7064
|
-
*
|
|
7065
|
-
*
|
|
7066
|
-
*
|
|
7067
|
-
* // ...
|
|
7068
|
-
* })();
|
|
7050
|
+
* const browser = await puppeteer.launch();
|
|
7051
|
+
* const page = await browser.newPage();
|
|
7052
|
+
* await page.goto('https://example.com');
|
|
7053
|
+
* const hrefElement = await page.$('a');
|
|
7054
|
+
* await hrefElement.click();
|
|
7055
|
+
* // ...
|
|
7069
7056
|
* ```
|
|
7070
7057
|
*
|
|
7071
7058
|
* ElementHandle prevents the DOM element from being garbage-collected unless the
|
|
7072
7059
|
* handle is {@link JSHandle.dispose | disposed}. ElementHandles are auto-disposed
|
|
7073
|
-
* when their
|
|
7060
|
+
* when their associated frame is navigated away or the parent
|
|
7061
|
+
* context gets destroyed.
|
|
7074
7062
|
*
|
|
7075
7063
|
* ElementHandle instances can be used as arguments in {@link Page.$eval} and
|
|
7076
7064
|
* {@link Page.evaluate} methods.
|
|
@@ -7347,9 +7335,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
7347
7335
|
*
|
|
7348
7336
|
* ```ts
|
|
7349
7337
|
* const feedHandle = await page.$('.feed');
|
|
7350
|
-
*
|
|
7351
|
-
*
|
|
7352
|
-
*
|
|
7338
|
+
*
|
|
7339
|
+
* const listOfTweets = await feedHandle.$$eval('.tweet', nodes =>
|
|
7340
|
+
* nodes.map(n => n.innerText),
|
|
7341
|
+
* );
|
|
7353
7342
|
* ```
|
|
7354
7343
|
*
|
|
7355
7344
|
* @param selector -
|
|
@@ -7408,24 +7397,22 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
7408
7397
|
* ```ts
|
|
7409
7398
|
* import puppeteer from 'puppeteer';
|
|
7410
7399
|
*
|
|
7411
|
-
*
|
|
7412
|
-
*
|
|
7413
|
-
*
|
|
7414
|
-
*
|
|
7415
|
-
*
|
|
7416
|
-
*
|
|
7417
|
-
*
|
|
7418
|
-
* .then(() => console.log('First URL with image: ' + currentURL));
|
|
7400
|
+
* const browser = await puppeteer.launch();
|
|
7401
|
+
* const page = await browser.newPage();
|
|
7402
|
+
* let currentURL;
|
|
7403
|
+
* page
|
|
7404
|
+
* .mainFrame()
|
|
7405
|
+
* .waitForSelector('img')
|
|
7406
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
|
7419
7407
|
*
|
|
7420
|
-
*
|
|
7421
|
-
*
|
|
7422
|
-
*
|
|
7423
|
-
*
|
|
7424
|
-
*
|
|
7425
|
-
*
|
|
7426
|
-
*
|
|
7427
|
-
*
|
|
7428
|
-
* })();
|
|
7408
|
+
* for (currentURL of [
|
|
7409
|
+
* 'https://example.com',
|
|
7410
|
+
* 'https://google.com',
|
|
7411
|
+
* 'https://bbc.com',
|
|
7412
|
+
* ]) {
|
|
7413
|
+
* await page.goto(currentURL);
|
|
7414
|
+
* }
|
|
7415
|
+
* await browser.close();
|
|
7429
7416
|
* ```
|
|
7430
7417
|
*
|
|
7431
7418
|
* @param selector - The selector to query and wait for.
|
|
@@ -8818,20 +8805,18 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
8818
8805
|
* ```ts
|
|
8819
8806
|
* import puppeteer from 'puppeteer';
|
|
8820
8807
|
*
|
|
8821
|
-
*
|
|
8822
|
-
*
|
|
8823
|
-
*
|
|
8824
|
-
*
|
|
8825
|
-
*
|
|
8826
|
-
* await browser.close();
|
|
8808
|
+
* const browser = await puppeteer.launch();
|
|
8809
|
+
* const page = await browser.newPage();
|
|
8810
|
+
* await page.goto('https://www.google.com/chrome/browser/canary.html');
|
|
8811
|
+
* dumpFrameTree(page.mainFrame(), '');
|
|
8812
|
+
* await browser.close();
|
|
8827
8813
|
*
|
|
8828
|
-
*
|
|
8829
|
-
*
|
|
8830
|
-
*
|
|
8831
|
-
*
|
|
8832
|
-
* }
|
|
8814
|
+
* function dumpFrameTree(frame, indent) {
|
|
8815
|
+
* console.log(indent + frame.url());
|
|
8816
|
+
* for (const child of frame.childFrames()) {
|
|
8817
|
+
* dumpFrameTree(child, indent + ' ');
|
|
8833
8818
|
* }
|
|
8834
|
-
* }
|
|
8819
|
+
* }
|
|
8835
8820
|
* ```
|
|
8836
8821
|
*
|
|
8837
8822
|
* @example
|
|
@@ -9146,24 +9131,22 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
9146
9131
|
* ```ts
|
|
9147
9132
|
* import puppeteer from 'puppeteer';
|
|
9148
9133
|
*
|
|
9149
|
-
*
|
|
9150
|
-
*
|
|
9151
|
-
*
|
|
9152
|
-
*
|
|
9153
|
-
*
|
|
9154
|
-
*
|
|
9155
|
-
*
|
|
9156
|
-
* .then(() => console.log('First URL with image: ' + currentURL));
|
|
9134
|
+
* const browser = await puppeteer.launch();
|
|
9135
|
+
* const page = await browser.newPage();
|
|
9136
|
+
* let currentURL;
|
|
9137
|
+
* page
|
|
9138
|
+
* .mainFrame()
|
|
9139
|
+
* .waitForSelector('img')
|
|
9140
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
|
9157
9141
|
*
|
|
9158
|
-
*
|
|
9159
|
-
*
|
|
9160
|
-
*
|
|
9161
|
-
*
|
|
9162
|
-
*
|
|
9163
|
-
*
|
|
9164
|
-
*
|
|
9165
|
-
*
|
|
9166
|
-
* })();
|
|
9142
|
+
* for (currentURL of [
|
|
9143
|
+
* 'https://example.com',
|
|
9144
|
+
* 'https://google.com',
|
|
9145
|
+
* 'https://bbc.com',
|
|
9146
|
+
* ]) {
|
|
9147
|
+
* await page.goto(currentURL);
|
|
9148
|
+
* }
|
|
9149
|
+
* await browser.close();
|
|
9167
9150
|
* ```
|
|
9168
9151
|
*
|
|
9169
9152
|
* @param selector - The selector to query and wait for.
|
|
@@ -9189,14 +9172,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
9189
9172
|
* ```ts
|
|
9190
9173
|
* import puppeteer from 'puppeteer';
|
|
9191
9174
|
*
|
|
9192
|
-
*
|
|
9193
|
-
*
|
|
9194
|
-
*
|
|
9195
|
-
*
|
|
9196
|
-
*
|
|
9197
|
-
* .
|
|
9198
|
-
*
|
|
9199
|
-
*
|
|
9175
|
+
* const browser = await puppeteer.launch();
|
|
9176
|
+
* const page = await browser.newPage();
|
|
9177
|
+
* const watchDog = page
|
|
9178
|
+
* .mainFrame()
|
|
9179
|
+
* .waitForFunction('window.innerWidth < 100');
|
|
9180
|
+
* page.setViewport({width: 50, height: 50});
|
|
9181
|
+
* await watchDog;
|
|
9182
|
+
* await browser.close();
|
|
9200
9183
|
* ```
|
|
9201
9184
|
*
|
|
9202
9185
|
* To pass arguments from Node.js to the predicate of `page.waitForFunction` function:
|
|
@@ -9869,13 +9852,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
9869
9852
|
*
|
|
9870
9853
|
* @public
|
|
9871
9854
|
*/
|
|
9872
|
-
var _HTTPRequest_brand = /*#__PURE__*/new WeakSet();
|
|
9873
9855
|
class HTTPRequest {
|
|
9874
9856
|
/**
|
|
9875
9857
|
* @internal
|
|
9876
9858
|
*/
|
|
9877
9859
|
constructor() {
|
|
9878
|
-
_classPrivateMethodInitSpec(this, _HTTPRequest_brand);
|
|
9879
9860
|
/**
|
|
9880
9861
|
* @internal
|
|
9881
9862
|
*/
|
|
@@ -9917,7 +9898,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
9917
9898
|
* `respond()` aren't called).
|
|
9918
9899
|
*/
|
|
9919
9900
|
continueRequestOverrides() {
|
|
9920
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
9921
9901
|
return this.interception.requestOverrides;
|
|
9922
9902
|
}
|
|
9923
9903
|
/**
|
|
@@ -9925,14 +9905,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
9925
9905
|
* interception is allowed to respond (ie, `abort()` is not called).
|
|
9926
9906
|
*/
|
|
9927
9907
|
responseForRequest() {
|
|
9928
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
9929
9908
|
return this.interception.response;
|
|
9930
9909
|
}
|
|
9931
9910
|
/**
|
|
9932
9911
|
* The most recent reason for aborting the request
|
|
9933
9912
|
*/
|
|
9934
9913
|
abortErrorReason() {
|
|
9935
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
9936
9914
|
return this.interception.abortReason;
|
|
9937
9915
|
}
|
|
9938
9916
|
/**
|
|
@@ -10001,6 +9979,13 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10001
9979
|
return await this._continue(this.interception.requestOverrides);
|
|
10002
9980
|
}
|
|
10003
9981
|
}
|
|
9982
|
+
/**
|
|
9983
|
+
* @internal
|
|
9984
|
+
*/
|
|
9985
|
+
verifyInterception() {
|
|
9986
|
+
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
9987
|
+
assert(!this.interception.handled, 'Request is already handled!');
|
|
9988
|
+
}
|
|
10004
9989
|
/**
|
|
10005
9990
|
* Continues request with optional request overrides.
|
|
10006
9991
|
*
|
|
@@ -10030,11 +10015,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10030
10015
|
* Exception is immediately thrown if the request interception is not enabled.
|
|
10031
10016
|
*/
|
|
10032
10017
|
async continue(overrides = {}, priority) {
|
|
10033
|
-
|
|
10018
|
+
this.verifyInterception();
|
|
10019
|
+
if (!this.canBeIntercepted()) {
|
|
10034
10020
|
return;
|
|
10035
10021
|
}
|
|
10036
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
10037
|
-
assert(!this.interception.handled, 'Request is already handled!');
|
|
10038
10022
|
if (priority === undefined) {
|
|
10039
10023
|
return await this._continue(overrides);
|
|
10040
10024
|
}
|
|
@@ -10087,11 +10071,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10087
10071
|
* Exception is immediately thrown if the request interception is not enabled.
|
|
10088
10072
|
*/
|
|
10089
10073
|
async respond(response, priority) {
|
|
10090
|
-
|
|
10074
|
+
this.verifyInterception();
|
|
10075
|
+
if (!this.canBeIntercepted()) {
|
|
10091
10076
|
return;
|
|
10092
10077
|
}
|
|
10093
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
10094
|
-
assert(!this.interception.handled, 'Request is already handled!');
|
|
10095
10078
|
if (priority === undefined) {
|
|
10096
10079
|
return await this._respond(response);
|
|
10097
10080
|
}
|
|
@@ -10125,13 +10108,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10125
10108
|
* throw an exception immediately.
|
|
10126
10109
|
*/
|
|
10127
10110
|
async abort(errorCode = 'failed', priority) {
|
|
10128
|
-
|
|
10111
|
+
this.verifyInterception();
|
|
10112
|
+
if (!this.canBeIntercepted()) {
|
|
10129
10113
|
return;
|
|
10130
10114
|
}
|
|
10131
10115
|
const errorReason = errorReasons[errorCode];
|
|
10132
10116
|
assert(errorReason, 'Unknown error code: ' + errorCode);
|
|
10133
|
-
assert(this.interception.enabled, 'Request Interception is not enabled!');
|
|
10134
|
-
assert(!this.interception.handled, 'Request is already handled!');
|
|
10135
10117
|
if (priority === undefined) {
|
|
10136
10118
|
return await this._abort(errorReason);
|
|
10137
10119
|
}
|
|
@@ -10159,9 +10141,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10159
10141
|
/**
|
|
10160
10142
|
* @public
|
|
10161
10143
|
*/
|
|
10162
|
-
function _canBeIntercepted() {
|
|
10163
|
-
return !this.url().startsWith('data:') && !this._fromMemoryCache;
|
|
10164
|
-
}
|
|
10165
10144
|
exports.InterceptResolutionAction = void 0;
|
|
10166
10145
|
(function (InterceptResolutionAction) {
|
|
10167
10146
|
InterceptResolutionAction["Abort"] = "abort";
|
|
@@ -10758,13 +10737,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
10758
10737
|
* ```ts
|
|
10759
10738
|
* import puppeteer from 'puppeteer';
|
|
10760
10739
|
*
|
|
10761
|
-
*
|
|
10762
|
-
*
|
|
10763
|
-
*
|
|
10764
|
-
*
|
|
10765
|
-
*
|
|
10766
|
-
* await browser.close();
|
|
10767
|
-
* })();
|
|
10740
|
+
* const browser = await puppeteer.launch();
|
|
10741
|
+
* const page = await browser.newPage();
|
|
10742
|
+
* await page.goto('https://example.com');
|
|
10743
|
+
* await page.screenshot({path: 'screenshot.png'});
|
|
10744
|
+
* await browser.close();
|
|
10768
10745
|
* ```
|
|
10769
10746
|
*
|
|
10770
10747
|
* The Page class extends from Puppeteer's {@link EventEmitter} class and will
|
|
@@ -11391,14 +11368,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
11391
11368
|
* import {KnownDevices} from 'puppeteer';
|
|
11392
11369
|
* const iPhone = KnownDevices['iPhone 15 Pro'];
|
|
11393
11370
|
*
|
|
11394
|
-
*
|
|
11395
|
-
*
|
|
11396
|
-
*
|
|
11397
|
-
*
|
|
11398
|
-
*
|
|
11399
|
-
*
|
|
11400
|
-
* await browser.close();
|
|
11401
|
-
* })();
|
|
11371
|
+
* const browser = await puppeteer.launch();
|
|
11372
|
+
* const page = await browser.newPage();
|
|
11373
|
+
* await page.emulate(iPhone);
|
|
11374
|
+
* await page.goto('https://www.google.com');
|
|
11375
|
+
* // other actions...
|
|
11376
|
+
* await browser.close();
|
|
11402
11377
|
* ```
|
|
11403
11378
|
*/
|
|
11404
11379
|
async emulate(device) {
|
|
@@ -11927,22 +11902,21 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
11927
11902
|
*
|
|
11928
11903
|
* ```ts
|
|
11929
11904
|
* import puppeteer from 'puppeteer';
|
|
11930
|
-
*
|
|
11931
|
-
*
|
|
11932
|
-
*
|
|
11933
|
-
*
|
|
11934
|
-
*
|
|
11935
|
-
*
|
|
11936
|
-
*
|
|
11937
|
-
*
|
|
11938
|
-
*
|
|
11939
|
-
*
|
|
11940
|
-
*
|
|
11941
|
-
*
|
|
11942
|
-
*
|
|
11943
|
-
*
|
|
11944
|
-
*
|
|
11945
|
-
* })();
|
|
11905
|
+
*
|
|
11906
|
+
* const browser = await puppeteer.launch();
|
|
11907
|
+
* const page = await browser.newPage();
|
|
11908
|
+
* let currentURL;
|
|
11909
|
+
* page
|
|
11910
|
+
* .waitForSelector('img')
|
|
11911
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
|
11912
|
+
* for (currentURL of [
|
|
11913
|
+
* 'https://example.com',
|
|
11914
|
+
* 'https://google.com',
|
|
11915
|
+
* 'https://bbc.com',
|
|
11916
|
+
* ]) {
|
|
11917
|
+
* await page.goto(currentURL);
|
|
11918
|
+
* }
|
|
11919
|
+
* await browser.close();
|
|
11946
11920
|
* ```
|
|
11947
11921
|
*
|
|
11948
11922
|
* @param selector -
|
|
@@ -11992,14 +11966,13 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
11992
11966
|
*
|
|
11993
11967
|
* ```ts
|
|
11994
11968
|
* import puppeteer from 'puppeteer';
|
|
11995
|
-
*
|
|
11996
|
-
*
|
|
11997
|
-
*
|
|
11998
|
-
*
|
|
11999
|
-
*
|
|
12000
|
-
*
|
|
12001
|
-
*
|
|
12002
|
-
* })();
|
|
11969
|
+
*
|
|
11970
|
+
* const browser = await puppeteer.launch();
|
|
11971
|
+
* const page = await browser.newPage();
|
|
11972
|
+
* const watchDog = page.waitForFunction('window.innerWidth < 100');
|
|
11973
|
+
* await page.setViewport({width: 50, height: 50});
|
|
11974
|
+
* await watchDog;
|
|
11975
|
+
* await browser.close();
|
|
12003
11976
|
* ```
|
|
12004
11977
|
*
|
|
12005
11978
|
* @example
|
|
@@ -17377,6 +17350,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
17377
17350
|
errorText: this._failureText
|
|
17378
17351
|
};
|
|
17379
17352
|
}
|
|
17353
|
+
canBeIntercepted() {
|
|
17354
|
+
return !this.url().startsWith('data:') && !this._fromMemoryCache;
|
|
17355
|
+
}
|
|
17380
17356
|
/**
|
|
17381
17357
|
* @internal
|
|
17382
17358
|
*/
|
|
@@ -23191,28 +23167,19 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
23191
23167
|
*
|
|
23192
23168
|
* ```ts
|
|
23193
23169
|
* import {PredefinedNetworkConditions} from 'puppeteer';
|
|
23194
|
-
*
|
|
23195
|
-
*
|
|
23196
|
-
*
|
|
23197
|
-
*
|
|
23198
|
-
*
|
|
23199
|
-
*
|
|
23200
|
-
*
|
|
23201
|
-
*
|
|
23202
|
-
*
|
|
23203
|
-
*
|
|
23204
|
-
*
|
|
23205
|
-
*
|
|
23206
|
-
*
|
|
23207
|
-
* ); // alias to Fast 3G.
|
|
23208
|
-
* await page.goto('https://www.google.com');
|
|
23209
|
-
* await page.emulateNetworkConditions(
|
|
23210
|
-
* PredefinedNetworkConditions['Fast 4G'],
|
|
23211
|
-
* );
|
|
23212
|
-
* await page.goto('https://www.google.com');
|
|
23213
|
-
* // other actions...
|
|
23214
|
-
* await browser.close();
|
|
23215
|
-
* })();
|
|
23170
|
+
* const browser = await puppeteer.launch();
|
|
23171
|
+
* const page = await browser.newPage();
|
|
23172
|
+
* await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 3G']);
|
|
23173
|
+
* await page.goto('https://www.google.com');
|
|
23174
|
+
* await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 3G']);
|
|
23175
|
+
* await page.goto('https://www.google.com');
|
|
23176
|
+
* // alias to Fast 3G.
|
|
23177
|
+
* await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 4G']);
|
|
23178
|
+
* await page.goto('https://www.google.com');
|
|
23179
|
+
* await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 4G']);
|
|
23180
|
+
* await page.goto('https://www.google.com');
|
|
23181
|
+
* // other actions...
|
|
23182
|
+
* await browser.close();
|
|
23216
23183
|
* ```
|
|
23217
23184
|
*
|
|
23218
23185
|
* @public
|
|
@@ -24763,14 +24730,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
24763
24730
|
* import {KnownDevices} from 'puppeteer';
|
|
24764
24731
|
* const iPhone = KnownDevices['iPhone 15 Pro'];
|
|
24765
24732
|
*
|
|
24766
|
-
*
|
|
24767
|
-
*
|
|
24768
|
-
*
|
|
24769
|
-
*
|
|
24770
|
-
*
|
|
24771
|
-
*
|
|
24772
|
-
* await browser.close();
|
|
24773
|
-
* })();
|
|
24733
|
+
* const browser = await puppeteer.launch();
|
|
24734
|
+
* const page = await browser.newPage();
|
|
24735
|
+
* await page.emulate(iPhone);
|
|
24736
|
+
* await page.goto('https://www.google.com');
|
|
24737
|
+
* // other actions...
|
|
24738
|
+
* await browser.close();
|
|
24774
24739
|
* ```
|
|
24775
24740
|
*
|
|
24776
24741
|
* @public
|
|
@@ -25079,9 +25044,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
|
|
|
25079
25044
|
* @internal
|
|
25080
25045
|
*/
|
|
25081
25046
|
const PUPPETEER_REVISIONS = Object.freeze({
|
|
25082
|
-
chrome: '
|
|
25083
|
-
'chrome-headless-shell': '
|
|
25084
|
-
firefox: 'stable_143.0'
|
|
25047
|
+
chrome: '141.0.7390.54',
|
|
25048
|
+
'chrome-headless-shell': '141.0.7390.54',
|
|
25049
|
+
firefox: 'stable_143.0.3'
|
|
25085
25050
|
});
|
|
25086
25051
|
|
|
25087
25052
|
/**
|
|
@@ -14,16 +14,14 @@ import type { Protocol } from 'devtools-protocol';
|
|
|
14
14
|
* ```ts
|
|
15
15
|
* import puppeteer from 'puppeteer';
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* page.evaluate(() => alert('1'));
|
|
26
|
-
* })();
|
|
17
|
+
* const browser = await puppeteer.launch();
|
|
18
|
+
* const page = await browser.newPage();
|
|
19
|
+
* page.on('dialog', async dialog => {
|
|
20
|
+
* console.log(dialog.message());
|
|
21
|
+
* await dialog.dismiss();
|
|
22
|
+
* await browser.close();
|
|
23
|
+
* });
|
|
24
|
+
* await page.evaluate(() => alert('1'));
|
|
27
25
|
* ```
|
|
28
26
|
*
|
|
29
27
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/api/Dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAIhD
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/api/Dialog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BAAsB,MAAM;;IAI1B;;OAEG;IACH,SAAS,CAAC,OAAO,UAAS;IAE1B;;OAEG;gBAED,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,YAAY,SAAK;IAOnB;;OAEG;IACH,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU;IAIhC;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE;QACjC,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjB;;;;;;OAMG;IACG,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAShD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"}
|