Tuesday 31 May 2022

How To Set Proxy in Selenium Webdriver Java | Selenium Proxy Authentication | Selenium Proxy Setting

                        In this video, we will see How To Set Proxy in Selenium Webdriver Java | Selenium Proxy Authentication | Selenium Proxy Setting 


Program Code:

import org.openqa.selenium.Proxy;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.chrome.ChromeOptions;


public class SetProxy {


public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver_win32\\chromedriver.exe");

ChromeOptions option=new ChromeOptions();

//option.setAcceptInsecureCerts(true);

//option.addExtensions(null);

Proxy p=new Proxy();

p.setHttpProxy("192.168.4.3:4444");

option.setCapability("proxy", p);

WebDriver driver=new ChromeDriver(option);

driver.manage().window().maximize();

driver.get("https://amazon.in");

System.out.println(driver.getTitle());


}


}  


Watch following video:


Watch on YouTube: https://www.youtube.com/watch?v=VIffQYc8VDs

No comments:

Post a Comment