We need to add capabilities in the chrome browser
DESIRED CAPABILITIES IS THE CLASS WHO HELP TO CUSTOMIZED THE CHROME BROWSER.
So first we need to create an object of the Desired Capabilities and then accept the SSL or Insure certificate. After this we need to create our local chrome driver option and provide the Desired Capabilities information to the local chrome driver option so that while creating the chrome driver object, we can pass the local chrome driver to pass the Desired Capabilities.
below is the code to use.
DesiredCapabilities dc = DesiredCapabilities.chrome();
// Accept insure certificate
dc.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
// Accept SSL certificate
dc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
//Local chrome option to set the capabilities
ChromeOptions co = new ChromeOptions();
co.merge(dc);
System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe");
System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY,"true");
//Pass the chrome option object into the chromedriver to tell the capabilities
WebDriver driver = new ChromeDriver(co);
Comments
Post a Comment