c# - How to get Selenium and Geckodriver to ignore unsecure locally served webpage on local execution -


i have latest geckodriver (0.18.0) , webdriver (3.5.1.0). running selenium tests locally , remotely. when run tests remotely against https site, run fine.

i use following references:

using nunit.framework; using openqa.selenium; using system; using openqa.selenium.firefox; using browser.core.framework.resources; using openqa.selenium.remote; using system.reflection; 

my remote code works is:

desiredcapabilities caps = null;  caps = firefoxoptions.tocapabilities() desiredcapabilities; caps.setcapability("acceptinsecurecerts", true); if (firefoxprofile != null) { caps.setcapability(firefoxdriver.profilecapabilityname, firefoxprofile.tobase64string()); }  caps.setcapability(capabilitytype.version, null); caps.setcapability(capabilitytype.platform, null);  var buildnumber = assembly.getexecutingassembly().getname().version.tostring(); caps.setcapability("build", buildnumber); caps.setcapability("name", testcontext.currentcontext.test.name);  console.writeline("http://10.32.26.16:8888/wd/hub");  iwebdriver driver = new remotewebdriver(new uri("http://10.32.26.16:8888/wd/hub"), caps, timespan.fromseconds(30)); driver.navigate().gotourl("https://rcpsc.releasecandidate-community360qa.net/login.aspx?action=enablelogin"); 

when run locally, can not seem bypass "your connection not secure" message firefox throws. here code running local, doesnt work:

var service = firefoxdriverservice.createdefaultservice(@"c:\seleniumdrivers", "geckodriver.exe"); service.firefoxbinarypath = @"c:\program files (x86)\mozilla firefox\firefox.exe";  var options = new firefoxoptions(); options.profile = new basefirefoxprofile();  iwebdriver driver = new firefoxdriver(service, options, timespan.fromseconds(30000)); driver.navigate().gotourl("https://rcpsc.releasecandidate-community360qa.net/login.aspx?action=enablelogin"); 

here goes custom firefoxprofile referenced:

public class basefirefoxprofile : firefoxprofile {     public basefirefoxprofile()         : base()     {         acceptuntrustedcertificates = true;     } } 

when running locally, "your connection not secure" message , test fails. when debug , view firefoxprofile, says acceptuntrustedcertificates correctly set true doesnt work


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -