I am using webdriver V 3.0.1 and firefox V 46. I am facing an error as "Your connection is not secure".
Please help me to overcome from this issue. Below you can find my code
System.setProperty("webdriver.gecko.driver","D:\\Software\\Webdriver\\gecko new\\geckodriver-v0.11.1-win64\\geckodriver.exe");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 0);
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(false);
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://qa.applications.marykayintouch.com/Login/Login.aspx");
Handle Untrusted Certificate Selenium Step 1-We have to create FirefoxProfile in Selenium. Step 2- We have some predefined method in Selenium called setAcceptUntrustedCertificates() which accept Boolean values(true/false)- so we will make it true. Step 3-Open Firefox browser with the above-created profile.
The easiest way to fix this secure connection error is to reset the Firefox settings. If that doesn't work, disable DNS over HTTPS or create a new Firefox profile. Disable the VPN client or proxy service. Your VPN and proxy service can interfere with the connection.
Look for the small gray shield icon in the extreme right-hand corner of the address bar. Click the "Load unsafe script" link. You will be taken back to the entry page of your course; navigate back to the page with the embedded video.
To me, the most simple and efficient solution was to do this
var options = new FirefoxOptions()
{
AcceptInsecureCertificates = true
};
using (var driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options))
{
// Your code
}
I tried using Sanjay Bhimani's example but it didn't work so looked into the available constructors and ended up with the above code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With