Puppeteer Scraper avatar
Puppeteer Scraper

Pricing

Pay per usage

Go to Store
Puppeteer Scraper

Puppeteer Scraper

Developed by

Apify

Apify

Maintained by Apify

Crawls websites with the headless Chrome and Puppeteer library using a provided server-side Node.js code. This crawler is an alternative to apify/web-scraper that gives you finer control over the process. Supports both recursive crawling and list of URLs. Supports login to website.

5.0 (5)

Pricing

Pay per usage

140

Total users

6.8k

Monthly users

859

Runs succeeded

>99%

Issue response

44 days

Last modified

23 days ago

AK

Inject Jquery issue

Closed

assured_kumquat opened this issue
2 years ago

Hi,

It seems not possible to inject jquery as specified in the documentation.

What is the proper way do do that ?

async function pageFunction(context) {
const { page, request, Apify } = context;
await Apify.utils.puppeteer.injectJQuery(page);
// "Apify.utils" is undefined
return {
url: request.url,
};
}

Thanks

adamek avatar

The method is now directly available in the crawling context and you no longer need to provide the page option as it gets used automatically:

https://crawlee.dev/api/puppeteer-crawler/interface/PuppeteerCrawlingContext#injectJQuery

async function pageFunction(context) {
const { request, injectJQuery } = context;
await injectJQuery();
return {
url: request.url,
};
}
adamek avatar

Where did you find the example? Current docs are correct, they only contain the contextual helper, so closing as answered. Be sure to read the latest version of the docs, sounds like you are viewing the old one for v2.

LS

lou_stable

19 days ago

FYI the academy docs still have the old v2 example, i ran into this issue today: https://docs.apify.com/academy/apify-scrapers/puppeteer-scraper