How to Use Mobile Proxies with Puppeteer
Puppeteer sets the proxy through a Chrome launch flag and signs in with page.authenticate. The script below opens the IP page through your line and prints the result.
What do I need before I start?
| Host | gw.mobileproxy.live |
|---|---|
| HTTP and HTTPS port | 9000 |
| SOCKS5 port | 9100 |
| Username | mp4x9q2.mobile.us.sid-a1b2.rot-10 |
| Password | YOUR_PASSWORD (your own line password) |
- Node.js 18 or newer
- Puppeteer (npm install puppeteer)
- Your username and password in your account under My lines. The username above is an example, and each part is explained in the username reference.
How do I set it up?
- Install Puppeteer with npm install puppeteer. It downloads a matching Chrome.
- Save the script below as check-ip.mjs.
- Replace YOUR_PASSWORD with your password.
- Run node check-ip.mjs and read the text that prints.
- Call page.authenticate on every new page that needs the login.
- Use a separate browser launch, with its own username, for each account or task that needs its own address.
What does the code look like?
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({
args: ["--proxy-server=http://gw.mobileproxy.live:9000"],
});
const page = await browser.newPage();
await page.authenticate({ username: "mp4x9q2.mobile.us.sid-a1b2.rot-10", password: "YOUR_PASSWORD" });
await page.goto("https://ipinfo.io/json");
console.log(await page.evaluate(() => document.body.innerText));
await browser.close();How do I check my IP?
The script prints the JSON from https://ipinfo.io/json. Check that the ip and country belong to your line.
https://ipinfo.io/json
On a mobile line you can ask for a fresh address at any time with your change-IP link, for example https://gw.mobileproxy.live/rotate/k7Qm2xV9. The real link for each line is in your account.
What if it does not work?
ERR_NO_SUPPORTED_PROXIES or ERR_PROXY_CONNECTION_FAILED.
Check the host and port in the flag, and write the scheme as http:// before the host.
The page asks for a login in a pop up.
Call page.authenticate before page.goto, on the same page object.
Each page shows a different IP.
The line rotates on its timer. Add a session id and raise the rotation time to hold one address longer.
Frequently asked questions
Can I use SOCKS5 with Puppeteer?
Chrome accepts socks5://host:port in the flag, but it does not support a login for SOCKS5, so the HTTP port is the usual choice.
Will it work headless?
Yes. The proxy flag and authenticate call work in headless and headed mode.
Can I try another country?
Change the country code in the username, for example from us to de, and run the script again.
Related guides
Need a line to connect?
Create an account, top up your balance and your first line is ready to use with Puppeteer.