
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Handle SSL Certificate in Safari with Selenium WebDriver
Selenium webdriver is capable of handling SSL certificate in the Safari browser. This is done with the help of the DesiredCapabilities class. We shall create an object of this class. Then apply the setCapability method on it and set the value of property CapabilityType.ACCEPT_SSL_CERTS to true.
The SSL is a protocol developed to have a secure connection between the server and the client browser. It verifies the website authenticity before any further communication with it.
Syntax
DesiredCapabilities pc = DesiredCapabilities.safari(); pc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
Example
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.safari.SafariDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.DesiredCapabilities; public class SSLErrorSafari{ public static void main(String[] args) { //instance of DesiredCapabilities DesiredCapabilities pc = DesiredCapabilities.safari(); //set capability pc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); //set capability to webdriver WebDriver driver=new SafariDriver(pc); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("application url to be entered"); } }
Advertisements