{"id":483,"date":"2012-12-18T15:33:28","date_gmt":"2012-12-18T21:33:28","guid":{"rendered":"https:\/\/chrisedwards.dreamhosters.com\/blog\/?p=483"},"modified":"2012-12-18T15:33:28","modified_gmt":"2012-12-18T21:33:28","slug":"automatically-ignoring-untrusted-ssl-certificates-in-firefox-using-webdriver-and-c","status":"publish","type":"post","link":"http:\/\/architester.com\/blog\/2012\/12\/18\/automatically-ignoring-untrusted-ssl-certificates-in-firefox-using-webdriver-and-c\/","title":{"rendered":"Automatically Ignoring Untrusted SSL Certificates in Firefox Using WebDriver and C#"},"content":{"rendered":"<p><strong>TL;DR &#8211; You can tell WebDriver to automatically ignore untrusted SSL certificates on Firefox by setting the &#8220;webdriver_assume_untrusted_issuer&#8221; preference to false in the Firefox profile.<\/strong><\/p>\n<p>We recently ran into an issue where our tests were failing because Firefox was showing the &#8220;This Connection is Untrusted&#8221; window. Firefox was complaining that our SSL certificate was not from a trusted source (this happens when you use self-signed certs for development). Here is the screen we were seeing:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-485\" title=\"This Connection Is Untrusted Image\" src=\"https:\/\/chrisedwards.dreamhosters.com\/blog\/wp-content\/uploads\/2012\/12\/UntrustedSSLCert-300x167.gif\" alt=\"The &quot;This Connection Is Untrusted&quot; page Firefox was showing\" width=\"300\" height=\"167\" srcset=\"http:\/\/architester.com\/blog\/wp-content\/uploads\/2012\/12\/UntrustedSSLCert-300x167.gif 300w, http:\/\/architester.com\/blog\/wp-content\/uploads\/2012\/12\/UntrustedSSLCert.gif 684w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Googling the issue brought up a lot of solutions for java, but none that worked for C#. We called it a night, and the next morning, when I got in, my coworkers Jason Bilyeu and Carl Cornett had solved the issue. They found that you can set the &#8220;webdriver_assume_untrusted_issuer&#8221; preference to &#8220;false&#8221; in the Firefox profile and it will ignore the cert.<\/p>\n<p>Here is the code:<\/p>\n<pre style=\"border: 2px solid #777; padding: 5px; font-size: 10pt; font-family: Tahoma; color: #f1f2f3; background: #232323;\"><span style=\"color:#cc7833;\">var<\/span>&nbsp;<span style=\"color:#b9b9ff;\">profile<\/span>&nbsp;<span style=\"color:#cc7833;\">=<\/span>&nbsp;<span style=\"color:#cc7833;\">new<\/span>&nbsp;<span style=\"color:#678cb1;\">FirefoxProfile<\/span>();\r\n<span style=\"color:#b9b9ff;\">profile<\/span><span style=\"color:#cc7833;\">.<\/span><span style=\"color:#ffc66d;\">SetPreference<\/span>(<span style=\"color:#a5c261;\">&quot;webdriver_assume_untrusted_issuer&quot;<\/span>,&nbsp;<span style=\"color:#cc7833;\">false<\/span>);\r\n<span style=\"color:#cc7833;\">return<\/span>&nbsp;<span style=\"color:#cc7833;\">new<\/span>&nbsp;<span style=\"color:#678cb1;\">FirefoxDriver<\/span>(&nbsp;<span style=\"color:#b9b9ff;\">profile<\/span>&nbsp;);<\/pre>\n<p>I hope this helps anyone who has had issues with this like we did.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR &#8211; You can tell WebDriver to automatically ignore untrusted SSL certificates on Firefox by setting the &#8220;webdriver_assume_untrusted_issuer&#8221; preference to false in the Firefox profile. We recently ran into an issue where our tests were failing because Firefox was showing the &#8220;This Connection is Untrusted&#8221; window. Firefox was complaining that our SSL certificate was not [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":485,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,98,31,8,67],"tags":[79,39,58,68,71,107],"class_list":["post-483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-acceptance-testing","category-c","category-testing","category-webdriver","tag-net","tag-acceptance-testing","tag-firefox","tag-selenium","tag-testing","tag-webdriver"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/posts\/483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/comments?post=483"}],"version-history":[{"count":10,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/posts\/483\/revisions"}],"predecessor-version":[{"id":494,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/posts\/483\/revisions\/494"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/media\/485"}],"wp:attachment":[{"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/media?parent=483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/categories?post=483"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/architester.com\/blog\/wp-json\/wp\/v2\/tags?post=483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}