β Join us - https://sendfox.com/thetestingacademy
In this video, We are going to learn How to Handle Proxy in Selenium(with Demo) | Handle Proxy Authentication.
π What is a Proxy Server?
A proxy server acts as a gateway between you and the internet. It's an intermediary server separating end users from the websites they browse.
Proxy servers act as a firewall and web filter, provide shared network connections, and cache data to speed up common requests
π Code to Handle it
Download Code : - https://scrolltest.com/automation/proxy
π How to Handle Proxy Authentication?
You can do via MultiPass for HTTP basic authentication
Download the extension from
https://chrome.google.com/webstore/detail/multipass-for-http-basic/enhldmjbphoeibbpdhmjkchohnidgnah
Download the extension as crx. You can get it as crx from chrome-extension-downloader
After that the config is simple.
static void initDriver() {
ChromeOptions cOptions = new ChromeOptions();
cOptions.addExtensions(new File("MultiPass-for-HTTP-basic-authentication_v.crx"));
driver = new ChromeDriver(cOptions);
configureAuth(
"https://the-internet.herokuapp.com/basic_auth",
"admin",
"admin");
}
static void configureAuthWithExtension(String url, String username, String password) {
driver.get("chrome-extension://enhldmjbphoeibbpdhmjkchohnidgnah/options.html");
driver.findElement(By.id("url")).sendKeys(url);
driver.findElement(By.id("username")).sendKeys(username);
driver.findElement(By.id("password")).sendKeys(password);
driver.findElement(By.className("credential-form-submit")).click();
}
π Charles DownLoad :
--
Be sure to subscribe for more videos like this!
Top comments (0)