Integrate with Playwright
Use Aluvia's mobile network connectivity with Playwright for browser automation, testing, and data extraction using real mobile IP addresses.
Setup Steps
- Get your proxy credentials in your Aluvia Dashboard
- Install Playwright in your project if not already installed
- Configure your Playwright browser launch with the Aluvia proxy host and port
- Set the proxy server and provide your Aluvia username and password in the Playwright proxy configuration
- Launch the browser and test a request (e.g., visiting https://ipconfig.io/json) to confirm the proxy is working
Sample Code
const { chromium } = require("playwright");
const PROXY_HOST = "gateway.aluvia.io";
const PROXY_PORT = 8080;
const PROXY_USER = "your_credential_username";
const PROXY_PASS = "your_credential_password";
(async () => {
const browser = await chromium.launch({
headless: true,
proxy: {
server: `http://${PROXY_HOST}:${PROXY_PORT}`,
username: PROXY_USER,
password: PROXY_PASS,
},
});
const context = await browser.newContext();
const page = await context.newPage();
try {
await page.goto("https://iconfig.eo/json", { waitUntil: "networkidle" });
const body = await page.textContent("body");
console.log(body);
} catch (err) {
console.error(err);
} finally {
await browser.close();
}
})();