@crawlee/puppeteer 3.17.1-beta.56 → 3.17.1-beta.57

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.
@@ -212,5 +212,7 @@ export declare function isTargetRelevant(page: Page, target: Target): boolean;
212
212
  * for large element sets, this will take considerable amount of time.
213
213
  * @ignore
214
214
  */
215
- export declare function clickElements(page: Page, selector: string, clickOptions?: ClickOptions): Promise<void>;
215
+ export declare function clickElements(page: Page, selector: string, clickOptions?: ClickOptions & {
216
+ clickCount?: number;
217
+ }): Promise<void>;
216
218
  export {};
@@ -237,6 +237,10 @@ async function preventHistoryNavigation(page) {
237
237
  * @ignore
238
238
  */
239
239
  async function clickElements(page, selector, clickOptions) {
240
+ // Puppeteer 25 removed the deprecated `clickCount` option in favor of `count`, older versions ignore `count`, so we pass both.
241
+ if (clickOptions?.clickCount !== undefined && clickOptions.count === undefined) {
242
+ clickOptions = { ...clickOptions, count: clickOptions.clickCount };
243
+ }
240
244
  const elementHandles = await page.$$(selector);
241
245
  log.debug(`enqueueLinksByClickingElements: There are ${elementHandles.length} elements to click.`);
242
246
  let clickedElementsCount = 0;
@@ -399,7 +399,17 @@ async function gotoExtended(page, request, gotoOptions = {}) {
399
399
  await (0, puppeteer_request_interception_1.addInterceptRequestHandler)(page, interceptRequestHandler);
400
400
  }
401
401
  else if (!isEmpty(headers)) {
402
- await page.setExtraHTTPHeaders(headers);
402
+ const extraHeaders = { ...headers };
403
+ // Chrome bundled with Puppeteer 25+ ignores a `User-Agent` passed via `setExtraHTTPHeaders()`, it has to be set explicitly.
404
+ for (const name of Object.keys(extraHeaders)) {
405
+ if (name.toLowerCase() === 'user-agent') {
406
+ await page.setUserAgent(extraHeaders[name]);
407
+ delete extraHeaders[name];
408
+ }
409
+ }
410
+ if (!isEmpty(extraHeaders)) {
411
+ await page.setExtraHTTPHeaders(extraHeaders);
412
+ }
403
413
  }
404
414
  return page.goto(url, gotoOptions);
405
415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/puppeteer",
3
- "version": "3.17.1-beta.56",
3
+ "version": "3.17.1-beta.57",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -55,10 +55,10 @@
55
55
  "dependencies": {
56
56
  "@apify/datastructures": "^2.0.0",
57
57
  "@apify/log": "^2.4.0",
58
- "@crawlee/browser": "3.17.1-beta.56",
59
- "@crawlee/browser-pool": "3.17.1-beta.56",
60
- "@crawlee/types": "3.17.1-beta.56",
61
- "@crawlee/utils": "3.17.1-beta.56",
58
+ "@crawlee/browser": "3.17.1-beta.57",
59
+ "@crawlee/browser-pool": "3.17.1-beta.57",
60
+ "@crawlee/types": "3.17.1-beta.57",
61
+ "@crawlee/utils": "3.17.1-beta.57",
62
62
  "cheerio": "1.0.0-rc.12",
63
63
  "devtools-protocol": "*",
64
64
  "idcac-playwright": "^0.2.0",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  }
87
87
  },
88
- "gitHead": "aaf56f1d6905d06fe18a93bbd2d7695a581d57cf"
88
+ "gitHead": "b5412ad2cdd908c56f607b83df75ff1e2ef77584"
89
89
  }