Using Playwright and Puppeteer with SOCKS5 Proxies (Node.js Guide)
Deepesh Kalur
Expert Contributor
For Playwright, pass the proxy config directly in launch options: proxy: { server: 'socks5://gw.snowpad.io:9999', username: '...', password: '...' }. For Puppeteer, use the proxy-chain package to handle SOCKS5 auth since Puppeteer does not support it natively.
Most proxy tutorials focus on Python, but a massive portion of the scraping community uses Node.js with Playwright and Puppeteer. These browser automation frameworks are essential for scraping JavaScript-heavy single-page applications.
Playwright Setup
Playwright has first-class SOCKS5 support. Configure it with Snowpad:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
proxy: {
server: 'socks5://gw.snowpad.io:9999',
username: 'your_username',
password: 'your_password'
}
});
const context = await browser.newContext({
userAgent: 'Mozilla/5.0 (Linux; Android 14; SM-S928B) AppleWebKit/537.36'
});
const page = await context.newPage();
await page.goto('https://httpbin.org/ip');
console.log(await page.textContent('body'));
await browser.close();
})();
Puppeteer Setup
Puppeteer requires proxy-chain for SOCKS5 authentication:
const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');
(async () => {
const oldProxyUrl = 'socks5://username:password@gw.snowpad.io:9999';
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);
const browser = await puppeteer.launch({
args: [`--proxy-server=${newProxyUrl}`]
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
console.log(await page.evaluate(() => document.body.textContent));
await browser.close();
await proxyChain.closeAnonymizedProxy(newProxyUrl, true);
})();
Playwright vs Puppeteer
Playwright is recommended for proxy use because it natively supports SOCKS5 authentication. Puppeteer requires external packages like proxy-chain for authenticated proxies.
FAQ
Which is better for proxy scraping: Playwright or Puppeteer? Playwright is better for proxy use because it natively supports SOCKS5 authentication. Puppeteer requires external packages for authenticated proxies.
Do I need stealth plugins with Snowpad proxies? Snowpad's mobile IPs already provide excellent stealth at the network level. Stealth plugins add browser-level evasion for heavily protected sites.
Can I run Playwright headless with proxies? Yes. Playwright runs headless by default. Combine with a mobile User-Agent and Snowpad proxy for undetectable headless scraping.
Frequently Asked Questions
Which is better for proxy scraping: Playwright or Puppeteer?
Playwright is better because it natively supports SOCKS5 authentication. Puppeteer requires external packages.
Do I need stealth plugins with Snowpad proxies?
Snowpad's mobile IPs provide excellent stealth at the network level. Stealth plugins add browser-level evasion.
Can I run Playwright headless with proxies?
Yes. Combine with a mobile User-Agent and Snowpad proxy for undetectable headless scraping.
Ready to try Snowpad?
Join thousands of developers using our Indian mobile proxy network for their high-scale automation needs.
Get Started Now