李骐辛骐辛
李骐辛骐辛

Reputation: 1

playwright's chromium use proxy invalid

playwright's version 1.46.1.

this code

import { ipcMain } from 'electron'; 
ipcMain.on('launchBrowser', async (event, arg,param) => { 
try {
const browserParam=JSON.parse(param); const browser = await chromium.launch({ 
headless: false, // ...browserParam 
proxy: {
server:'socks://38.108.116.198:27235',
username:'7518dec1', 
password: 'xxx' //the password is hide 
} 
}); 
const context = await browser.newContext({ ...browserParam, }); 
const page = await context.newPage(); 
await page.goto('https://ip77.net'); 
}
catch (error) { console.error('Error launching browser:', error); } }); 

error:

Error launching browser: page.goto: net::ERR_SOCKS_CONNECTION_FAILED at https://ip77.net/

other set:

proxy: { 
server: 'socks5://38.108.116.198:27235', // socks => socks5 username: '7518dec1', password: 'xxx' 
}

the chromium.launch method's LaunchOptions surpport "socks5:..." and this is playwright's tip,

 /**
     * Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example `http://myproxy.com:3128` or
     * `socks5://myproxy.com:3128`. Short form `myproxy.com:3128` is considered an HTTP proxy.
     */

but use set has error, 'socks5://38.108.116.198:27235'

Error launching browser: browserType.launch: Browser does not support socks5 proxy authentication

I want use electron-vite + playwright + fingerprintjs realize Independent and multi open browser and Multiple IPs.

Upvotes: 0

Views: 209

Answers (0)

Related Questions