puppeteer-browser-ready 1.2.2 → 1.2.3

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 CHANGED
@@ -91,7 +91,7 @@ const handleResponse = (web) => {
91
91
  console.log('Hello, World!');
92
92
  console.log('web fields:', Object.keys(web).join(', '));
93
93
  console.log(`The HTML from ${web.location.href} is ${web.html.length} characters`,
94
- `long and contains ${web.$('p').length} <p> tags.`);
94
+ `long and contains ${web.root.querySelectorAll('p').length} <p> tags.`);
95
95
  return web;
96
96
  };
97
97
  puppeteer.launch()
@@ -102,7 +102,7 @@ puppeteer.launch()
102
102
  **Output:**
103
103
  ```
104
104
  Hello, World!
105
- web fields: browser, page, response, title, html, $
105
+ web fields: browser, page, response, status, location, title, html, root
106
106
  The HTML from https://pretty-print-json.js.org/ is 8200 characters
107
107
  long and contains 7 <p> tags.
108
108
  ```
@@ -137,7 +137,7 @@ describe('The web page', () => {
137
137
  });
138
138
 
139
139
  it('has exactly one header, main, and footer', () => {
140
- const actual = web.$('body >*').toArray().map(elem => elem.name);
140
+ const actual = getTags('body >*');
141
141
  const expected = ['header', 'main', 'footer'];
142
142
  assertDeepStrictEqual(actual, expected);
143
143
  });
@@ -1,4 +1,4 @@
1
- //! puppeteer-browser-ready v1.2.2 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
1
+ //! puppeteer-browser-ready v1.2.3 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
2
2
 
3
3
  /// <reference types="cheerio" />
4
4
  import { Browser, HTTPResponse, Page } from 'puppeteer';
@@ -1,4 +1,4 @@
1
- //! puppeteer-browser-ready v1.2.2 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
1
+ //! puppeteer-browser-ready v1.2.3 ~~ https://github.com/center-key/puppeteer-browser-ready ~~ MIT License
2
2
 
3
3
  import { parse } from 'node-html-parser';
4
4
  import cheerio from 'cheerio';
@@ -43,9 +43,9 @@ const browserReady = {
43
43
  return http.terminator.terminate();
44
44
  },
45
45
  goto(url, options) {
46
- const defaults = { addCheerio: true, parseHtml: true, verbose: false };
46
+ const defaults = { addCheerio: false, parseHtml: true, verbose: false };
47
47
  const settings = { ...defaults, ...options };
48
- if (options?.addCheerio)
48
+ if (settings.addCheerio)
49
49
  console.log('puppeteer-browser-ready: Option "addCheerio" is deprecated, use "parseHtml" instead.');
50
50
  const log = (label, msg) => settings.verbose &&
51
51
  console.log(' ', Date.now() % 100000, label + ':', msg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puppeteer-browser-ready",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Simple utility to go to a URL and wait for the HTTP response",
5
5
  "license": "MIT",
6
6
  "type": "module",