Skip to main content

How to handle the SSL certificate and Insure certificate in Selenium WebDriver?


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

Popular posts from this blog

What is API?

In general way, API (Application Programming Interface) is the intermediate software which is useful for two applications to communicate. API is the tool which is used for interaction of two applications. If developer developing any software which have multiple blocks (Modules) than developer use APIs to put them together.

Structural Testing

Structural Testing is the type of testing in which user should have the knowledge of the code because in this testing user need to check the structure of the system. Structural Testing is White Box Testing.