Selenium Ip Address Changing Code Not Working

I am trying to make selenium change a ip address but it isn't working. The ip addresses are taken from

const {Builder, By, Key, until} = require('selenium-webdriver');

const proxies = [
"47.243.167.134 :8889",
"154.236.179.233:1976",
"200.105.215.22:33630",
];

async function changeIP() {
 const proxy = proxies[Math.floor(Math.random() * proxies.length)];
const capabilities = {
'browserName': 'chrome',
'chromeOptions': {
  'args': [`--proxy-server=
}
};

const driver = await new Builder().withCapabilities(capabilities).build();

await driver.get("");
}

changeIP();
2

1 Answer

Free proxies usually don't work or areextremely slow and unsecure.

For thet reason, you might consider using some cheap proxies.

Also, after changing the proxies, you need to restart the driver for an effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest