Skip to main content
Selenium is a powerful browser automation framework used for web testing, scraping, and automating repetitive browser tasks. It supports multiple programming languages and browsers. By integrating Nimble’s proxy network with Selenium, you can route your automated browser requests through residential IPs, enabling access to geo-restricted content and avoiding IP-based blocking.

Prerequisites

  • Node.js installed on your system
  • Nimble account with proxy credentials

Follow these steps to integrate Nimble

1

Install dependencies

Install Selenium WebDriver and the proxy-chain package:
npm install selenium-webdriver proxy-chain
2

Get your proxy credentials

  • In the Nimble User Dashboard, navigate to the Pipelines page and click “add pipeline” to get your pipeline’s proxy connection details.
  • In your new pipeline, you will find the IP address, port, username, and password.
  • Your proxy URL format will be: http://username:[email protected]:7000
3

Implement the proxy connection

Use the following code to connect Selenium through Nimble’s proxy:
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const proxyChain = require('proxy-chain');

(async () => {
  // Replace with your Nimble pipeline credentials
  const proxyUrl = 'http://YOUR_USERNAME:[email protected]:7000';

  // Anonymize the proxy URL (handles authentication)
  const anonymizedProxy = await proxyChain.anonymizeProxy(proxyUrl);

  // Configure Chrome options with proxy
  const options = new chrome.Options();
  options.addArguments(`--proxy-server=${anonymizedProxy}`);
  options.addArguments('--no-sandbox');
  options.addArguments('--disable-setuid-sandbox');

  // Build the WebDriver
  const driver = await new Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .build();

  try {
    // Navigate to your target URL
    await driver.get('https://example.com');

    // Get page title
    const title = await driver.getTitle();
    console.log('Page title:', title);

    // Your automation logic here...

  } finally {
    // Clean up
    await driver.quit();
    await proxyChain.closeAnonymizedProxy(anonymizedProxy, true);
  }
})();
The proxy-chain package is required because Selenium doesn’t natively support proxy authentication with Chrome. It creates a local proxy server that handles the authentication for you.

Configuration options

ParameterValueDescription
Hostip.nimbleway.comNimble proxy endpoint
Port7000Default proxy port
UsernameYour pipeline usernameFrom your Nimble dashboard
PasswordYour pipeline passwordFrom your Nimble dashboard

Geo-targeting example

To route requests through a specific country, append the country code to your username:
// Route through US proxies
const proxyUrl = 'http://YOUR_USERNAME-country-us:[email protected]:7000';

// Route through Germany proxies
const proxyUrl = 'http://YOUR_USERNAME-country-de:[email protected]:7000';

Verify your connection

You can verify your proxy connection by checking your IP address:
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const proxyChain = require('proxy-chain');

(async () => {
  const proxyUrl = 'http://YOUR_USERNAME:[email protected]:7000';
  const anonymizedProxy = await proxyChain.anonymizeProxy(proxyUrl);

  const options = new chrome.Options();
  options.addArguments(`--proxy-server=${anonymizedProxy}`);

  const driver = await new Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .build();

  await driver.get('https://api.ipify.org');
  const ip = await driver.findElement({ css: 'body' }).getText();
  console.log('Your proxy IP:', ip);

  await driver.quit();
  await proxyChain.closeAnonymizedProxy(anonymizedProxy, true);
})();
That’s all! Selenium will now route all requests through Nimble’s proxy network.