
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 Selenium WebDriver for Edge
We can handle SSL certificates in Edge browser with Selenium webdriver. This is done with the help of the EdgeOptions class. We shall create an object of this class and set the parameter setAcceptInsecureCerts to the true value.
Finally, this information has to be passed to the webdriver object to get the desired browser settings. An SSL is a protocol designed to establish a secured connection between the server and the browser.
Syntax
EdgeOptions e = new EdgeOptions(); e.setAcceptInsecureCerts(true);
Code Implementation
import org.openqa.selenium.WebDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.edge.EdgeOptions; public class EdgeBrwserSSL{ public static void main(String[] args) { System.setProperty("webdriver.edge.driver", "C:\Users\ghs6kor\Desktop\Java\msedgedriver.exe"); //instance of EdgeOptions EdgeOptions e = new EdgeOptions(); //configure setAcceptInsecureCerts to true boolean value e.setAcceptInsecureCerts(true); //object of EdgeDriver WebDriver driver = new EdgeDriver(e); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("application url"); } }
Advertisements