Advertisement
dereksir

Untitled

Aug 8th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const puppeteer = require('puppeteer-extra');
  2. const RecaptchaPlugin = require('puppeteer-extra-plugin-recaptcha');
  3.  
  4. // Configure the plugin with a CAPTCHA-solving service provider (e.g., 2Captcha)
  5. puppeteer.use(RecaptchaPlugin({
  6.   provider: { id: '2captcha', token: 'YOUR_2CAPTCHA_API_KEY' },
  7. }));
  8.  
  9. (async () => {
  10.   const browser = await puppeteer.launch({ headless: true });
  11.   const page = await browser.newPage();
  12.  
  13.   // Navigate to a web page with a reCAPTCHA challenge
  14.   await page.goto('https://www.example.com');
  15.  
  16.   // Solve reCAPTCHA challenges on the page
  17.   const recaptchaSolutions = await page.solveRecaptchas();
  18.  
  19.   // Navigate to a sample website
  20.   await page.goto('https://www.example.com');
  21.  
  22.   // Take a screenshot of the page
  23.   await page.screenshot({ path: 'screenshot.png' });
  24.  
  25.   console.log(`Screenshot saved as screenshot.png`);
  26.  
  27.   // Close the browser
  28.   await browser.close();
  29. })();
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement