Selenium is an advanced browser automation software used to simulate browsing environments for the most accurate website testing and more
Bright Data Super Proxy and Selenium Integration
- Begin by going to your Bright Data Dashboard and clicking ‘create a Zone’.
- Choose ‘Network type’ and click save.
- Within Selenium fill in the ‘Proxy IP:Port’ in the ‘setProxy’ function for examplezproxy.lum-superproxy.io:22225 of both HTTP and HTTPS.
- Under ‘sendKeys’ input your Bright Data account ID and proxy Zone name:
lum-customer-CUSTOMER-zone-YOURZONE
and your Zone password found in the Zone settings. - For example:
const {Builder, By, Key, until} = require('selenium-webdriver');
const proxy = require('selenium-webdriver/proxy');
(async function example(){
let driver = await new Builder().forBrowser('firefox').setProxy(proxy.manual({
http: 'zproxy.lum-superproxy.io:22225',
https: 'zproxy.lum-superproxy.io:22225'
})).build()
try {
await driver.get('http://lumtest.com/myip.json');
driver.switchTo().alert()
.sendKeys('lum-customer-USERNAME-zone-YOURZONE'+Key.TAB+'PASSWORD');
driver.switchTo().alert().accept();
} finally {
await driver.quit();
}
})();
Proxy Manager and Selenium Integration
- Create a Zone with the network, IP type, and number of IPs you wish to use.
- Install the Bright Data Proxy Manager.
- Click ‘add new proxy’ and choose the Zone and settings you require, click ‘save’.
- In Selenium under the setProxy input your local IP and proxy manager port (i.e. 127.0.0.1:24000)
- The local host IP is 127.0.0.1
- The port created in the Proxy Manager is 24XXX, for example 24000
- Leave the username and password field empty, as the Bright Data Proxy Manager has already been authenticated with the Super Proxy.
- For example:
const {Builder, By, Key, until} = require('selenium-webdriver');
const proxy = require('selenium-webdriver/proxy');
(async function example(){
let driver = await new Builder().forBrowser('firefox').setProxy(proxy.manual({
http: '127.0.0.1:24000',
https: '127.0.0.1:24000'
})).build()
try {
await driver.get('http://lumtest.com/myip.json');
driver.switchTo().alert().accept();
} finally {
await driver.quit();
}
})();