
- Selenium - Home
- Selenium - Overview
- Selenium - Components
- Selenium - Automation Testing
- Selenium - Environment Setup
- Selenium - Remote Control
- Selenium - IDE Introduction
- Selenium - Features
- Selenium - Limitations
- Selenium - Installation
- Selenium - Creating Tests
- Selenium - Creating Script
- Selenium - Control Flow
- Selenium - Store Variables
- Selenium - Alerts & Popups
- Selenium - Selenese Commands
- Selenium - Actions Commands
- Selenium - Accessors Commands
- Selenium - Assertions Commands
- Selenium - Assert/Verify Methods
- Selenium - Locating Strategies
- Selenium - Script Debugging
- Selenium - Verification Points
- Selenium - Pattern Matching
- Selenium - JSON Data File
- Selenium - Browser Execution
- Selenium - User Extensions
- Selenium - Code Export
- Selenium - Emitting Code
- Selenium - JavaScript Functions
- Selenium - Plugins
- Selenium WebDriver Tutorial
- Selenium - Introduction
- Selenium WebDriver vs RC
- Selenium - Installation
- Selenium - First Test Script
- Selenium - Driver Sessions
- Selenium - Browser Options
- Selenium - Chrome Options
- Selenium - Edge Options
- Selenium - Firefox Options
- Selenium - Safari Options
- Selenium - Double Click
- Selenium - Right Click
- HTML Report in Python
- Handling Edit Boxes
- Selenium - Single Elements
- Selenium - Multiple Elements
- Selenium Web Elements
- Selenium - File Upload
- Selenium - Locator Strategies
- Selenium - Relative Locators
- Selenium - Finders
- Selenium - Find All Links
- Selenium - User Interactions
- Selenium - WebElement Commands
- Selenium - Browser Interactions
- Selenium - Browser Commands
- Selenium - Browser Navigation
- Selenium - Alerts & Popups
- Selenium - Handling Forms
- Selenium - Windows and Tabs
- Selenium - Handling Links
- Selenium - Input Boxes
- Selenium - Radio Button
- Selenium - Checkboxes
- Selenium - Dropdown Box
- Selenium - Handling IFrames
- Selenium - Handling Cookies
- Selenium - Date Time Picker
- Selenium - Dynamic Web Tables
- Selenium - Actions Class
- Selenium - Action Class
- Selenium - Keyboard Events
- Selenium - Key Up/Down
- Selenium - Copy and Paste
- Selenium - Handle Special Keys
- Selenium - Mouse Events
- Selenium - Drag and Drop
- Selenium - Pen Events
- Selenium - Scroll Operations
- Selenium - Waiting Strategies
- Selenium - Explicit/Implicit Wait
- Selenium - Support Features
- Selenium - Multi Select
- Selenium - Wait Support
- Selenium - Select Support
- Selenium - Color Support
- Selenium - ThreadGuard
- Selenium - Errors & Logging
- Selenium - Exception Handling
- Selenium - Miscellaneous
- Selenium - Handling Ajax Calls
- Selenium - JSON Data File
- Selenium - CSV Data File
- Selenium - Excel Data File
- Selenium - Cross Browser Testing
- Selenium - Multi Browser Testing
- Selenium - Multi Windows Testing
- Selenium - JavaScript Executor
- Selenium - Headless Execution
- Selenium - Capture Screenshots
- Selenium - Capture Videos
- Selenium - Page Object Model
- Selenium - Page Factory
- Selenium - Record & Playback
- Selenium - Frameworks
- Selenium - Browsing Context
- Selenium - DevTools
- Selenium Grid Tutorial
- Selenium - Overview
- Selenium - Architecture
- Selenium - Components
- Selenium - Configuration
- Selenium - Create Test Script
- Selenium - Test Execution
- Selenium - Endpoints
- Selenium - Customizing a Node
- Selenium Reporting Tools
- Selenium - Reporting Tools
- Selenium - TestNG
- Selenium - JUnit
- Selenium - Allure
- Selenium & other Technologies
- Selenium - Java Tutorial
- Selenium - Python Tutorial
- Selenium - C# Tutorial
- Selenium - Javascript Tutorial
- Selenium - Kotlin Tutorial
- Selenium - Ruby Tutorial
- Selenium - Maven & Jenkins
- Selenium - Database Testing
- Selenium - LogExpert Logging
- Selenium - Log4j Logging
- Selenium - Robot Framework
- Selenium - AutoIT
- Selenium - Flash Testing
- Selenium - Apache Ant
- Selenium - Github Tutorial
- Selenium - SoapUI
- Selenium - Cucumber
- Selenium - IntelliJ
- Selenium - XPath
- Selenium Miscellaneous Concepts
- Selenium - IE Driver
- Selenium - Automation Frameworks
- Selenium - Keyword Driven Framework
- Selenium - Data Driven Framework
- Selenium - Hybrid Driven Framework
- Selenium - SSL Certificate Error
- Selenium - Alternatives
Selenium - SSL Certificate Error
SSL Certificate error can be handled using the Selenium Webdriver. A SSL is the standardized protocol used to create a connection between the browser and server. The information exchanged via a SSL certificate is encrypted and it verifies if the information is sent to the correct server. It authenticates a website and provides protection from hacking. An untrusted SSL certificate error is thrown if there are problems in the SSL certificate. We should receive such an error while launching an application.
Selenium Webdriver has the DesiredCapabilities class to defile profiles for browsers. DesiredCapabilities class used with Option classes can be used to handle SSL certificates error in different browsers in Selenium Webdriver.The below image shows an example of an error, which was obtained by opening the URL: https://expired.badssl.com/ in Safari browser.

Chrome Browser
To handle SSL certificates in Chrome, we have to use the ChromeOptions class along with the DesiredCapabilities class. The SSL error shown in Chrome is Your connection is not private.
Code Implementation
package org.example; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.concurrent.TimeUnit; public class SSLErrorChrome { public static void main(String[] args) throws InterruptedException { // Desired Capabilities class to profile Chrome DesiredCapabilities dc = new DesiredCapabilities(); dc.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); // Chrome Options class ChromeOptions opt = new ChromeOptions(); opt.merge(dc); // Initiate the Webdriver with options WebDriver driver = new ChromeDriver(opt); // adding implicit wait of 15 secs driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); // launch application with SSL error driver.get("https://expired.badssl.com"); // get browser title System.out.println("Browser title in Chrome: " + driver.getTitle()); // quiting the browser driver.quit(); } }
Output
Browser title in Chrome: Privacy error
In the above example, we handled the SSL certificate error in Chrome and launched the application and then obtained the browser title with the message in the console - Browser title in Chrome: Privacy error.
Firefox Browser
To handle SSL certificates in Firefox, we have to use the FirefoxOptions class along with the DesiredCapabilities class. SSL error shown in Firefox is Warning: Potential Security Risk Ahead.
Code Implementation
package org.example; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.concurrent.TimeUnit; public class SSLErrorFirefox { public static void main(String[] args) throws InterruptedException { // Desired Capabilities class to profile Firefox DesiredCapabilities dc = new DesiredCapabilities(); dc.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); // Firefox Options class FirefoxOptions opt = new FirefoxOptions(); opt.merge(dc); // Initiate the Webdriver with options WebDriver driver = new FirefoxDriver(opt); // adding implicit wait of 15 secs driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); // launch application with SSL error driver.get("https://expired.badssl.com"); // get browser title System.out.println("Browser title in Firefox: " + driver.getTitle()); // quitting the browser driver.quit(); } }
Output
Browser title in Firefox: Privacy error
In the above example, we had handled the SSL certificate error in Firefox and launched the application and then obtained the browser title with the message in the console - Browser title in Firefox: Privacy error.
Edge Browser
To handle SSL certificates in Edge, we have to use the EdgeOptions class along with the DesiredCapabilities class. SSL error shown in Edge is Your connection isnt private.
Code Implementation
package org.example; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.EdgeDriver; import org.openqa.selenium.firefox.EdgeOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.concurrent.TimeUnit; public class SSLErrorEdge { public static void main(String[] args) throws InterruptedException { // Desired Capabilities class to profile Edge DesiredCapabilities dc = new DesiredCapabilities(); // Desired Capabilities class to profile Edge DesiredCapabilities dc = new DesiredCapabilities(); dc.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); // Edge Options class EdgeOptionsOptions opt = new EdgeOptions(); opt.merge(dc); // Initiate the Webdriver with options WebDriver driver = new EdgeDriver(opt); // adding implicit wait of 15 secs driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); // launch application with SSL error driver.get("https://expired.badssl.com"); // get browser title System.out.println("Browser title in Edge: " + driver.getTitle()); // quitting the browser driver.quit(); } }
Output
Browser title in Edge: Privacy error
In the above example, we handled the SSL certificate error in Edge and launched the application and then obtained the browser title with the message in the console - Browser title in Edge: Privacy error.
Safari Browser
To handle SSL certificates in Safari, we have to use the SafariOptions class along with the DesiredCapabilities class. SSL error shown in Safari is This connection is not private.
Code Implementation
package org.example; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.SafariDriver; import org.openqa.selenium.firefox.SafariOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.concurrent.TimeUnit; public class SSLErrorSafari { public static void main(String[] args) throws InterruptedException { // Desired Capabilities class to profile Safari DesiredCapabilities dc = new DesiredCapabilities(); dc.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); // Safari Options class SafariOptions opt = new SafariOptions(); opt.merge(dc); // Initiate the Webdriver with options WebDriver driver = new SafariDriver(opt); // adding implicit wait of 15 secs driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); // launch application with SSL error driver.get("https://expired.badssl.com"); // get browser title System.out.println("Browser title in Safari: " + driver.getTitle()); // quitting the browser driver.quit(); } }
Output
Browser title in Safari: Privacy error
In the above example, we had handled the SSL certificate error in Safari and launched the application and then obtained the browser title with the message in the console - Browser title in Safari: Privacy error.
This concludes our comprehensive take on the tutorial on Selenium - SSL Certificate Error. Weve started with describing what SSL Certificate errors, and walked through examples of how to handle SSL Certificate errors in different browsers with Selenium Webdriver. This equips you with in-depth knowledge of the Selenium - SSL Certificate Error. It is wise to keep practicing what youve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.