java - How can i resolve insecure connection on mozilla firefox 54 in selenium -


i have used selenium 3.4 along geckodriver v0.18.0.

to handle ssl certificates in firefox used capabilities of selenium webdriver:

profilesini profile = new profilesini(); firefoxprofile myprofile = profile.getprofile("default"); myprofile.setacceptuntrustedcertificates(true); myprofile.setassumeuntrustedcertificateissuer(false); driver = new firefoxdriver(myprofile); 

but still showing insecure connection after firefox launch

here answer question:

as per question without reference url ssl certificates blocking, here minimum code block bypass ssl certificate. in code block use desiredcapabilities class set capabilitytype of accept_ssl_certs true follows:

package certificateissue;  import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.remote.capabilitytype; import org.openqa.selenium.remote.desiredcapabilities; import org.testng.annotations.test;  public class certificateissue_firefox  {      @test     public void handlecertificate()     {         system.setproperty("webdriver.gecko.driver", "c:\\utility\\browserdrivers\\geckodriver.exe");          desiredcapabilities cap= new desiredcapabilities();         cap.setcapability(capabilitytype.accept_ssl_certs, true);          webdriver driver = new firefoxdriver(cap);         driver.get("http://www.cacert.org/");      } } 

let me know if answers question.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -