How to connect to ScrapingAnt proxy via Puppeteer?
Introduction
The documentation below describes how to use ScrapingAnt service with Puppeteer. Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.
ScrapingAnt services are compatible with many software platforms and tools, from operating systems to browser add-ons. Explore our step-by-step integration guides and learn how to set up your proxies.
Proxy protocol and authentication
For the HTTP proxy connection used below, set --proxy-server=http://residential.scrapingant.com:8080. HTTPS target pages still use an HTTP CONNECT tunnel. This is different from an HTTPS proxy, where the connection to the proxy itself uses TLS; Chromium also supports HTTPS proxies.
Use your residential proxy credentials with page.authenticate() before navigation. Do not embed credentials in --proxy-server: Chromium does not use credentials supplied in manual proxy settings. For datacenter proxies, substitute datacenter.scrapingant.com:8080 and the credentials from your datacenter settings.
Setup example
Use Node.js 22.12 or newer. Install Puppeteer in a Node.js project, save the following as proxy.cjs, replace the credential placeholders, then run node proxy.cjs:
npm install puppeteer@25.12.0
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
args: ['--proxy-server=http://residential.scrapingant.com:8080']
});
try {
const page = await browser.newPage();
await page.authenticate({
username: '<YOUR_USERNAME>',
password: '<YOUR_PASSWORD>'
});
await page.goto('https://httpbin.org/ip');
console.log(await page.$eval('body', element => element.innerText));
// Perform your actions here
} finally {
await browser.close();
}
})().catch(error => {
console.error(error);
process.exitCode = 1;
});
The IP endpoint prints the exit address used for that request. For an authentication error, check the proxy product credentials; for a connection error, check the hostname and port. Keep authentication before page.goto() and see the residential setup for country and session parameters.