Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Improve docs
Ondra Urban1d3a591387b4
diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.jsindex 465900679..ccccaf3b7 100644--- a/src/puppeteer_utils.js+++ b/src/puppeteer_utils.js@@ -59,6 +59,9 @@ const hideWebDriver = async (page) => {* Unlike Puppeteer's `addScriptTag` function, this function works on pages* with arbitrary Cross-Origin Resource Sharing (CORS) policies.*+ * Make sure that you're injecting the file after the page has loaded (after `page.goto()`). Otherwise,+ * the navigation will override the existing environment and the library will no longer be available.+ ** @param {Page} page* Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank"><code>Page</code></a> object.* @param {String} filePath File path@@ -82,6 +85,9 @@ const injectFile = async (page, filePath) => {* Beware that the injected jQuery object will be set to the `window.$` variable and thus it might cause conflicts with* libraries included by the page that use the same variable (e.g. another version of jQuery).*+ * Also make sure that you're injecting jQuery after the page has loaded (after `page.goto()`). Otherwise,+ * the navigation will override the existing environment and the library will no longer be available.+ ** Example usage:* ```javascript* await Apify.utils.puppeteer.injectJQuery(page);@@ -111,6 +117,9 @@ const injectJQuery = (page) => {* Beware that the injected Underscore object will be set to the `window._` variable and thus it might cause conflicts with* libraries included by the page that use the same variable.*+ * Also make sure that you're injecting Underscore after the page has loaded (after `page.goto()`). Otherwise,+ * the navigation will override the existing environment and the library will no longer be available.+ ** @param {Page} page Puppeteer [Page](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) object.* @return {Promise}* @memberOf puppeteer