1

I have the latest geckodriver (0.18.0) and webdriver (3.5.1.0). I am running Selenium tests locally and remotely. When I run my tests remotely against an HTTPS site, they run fine.

I use the 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 that works is:

DesiredCapabilities caps = null;

caps = FirefoxOptions.ToCapabilities() as 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 I run locally, I can not seem to bypass the "Your connection is not secure" message that firefox throws. Here is my code for running local, which 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 the custom firefoxprofile that is referenced:

public class BaseFirefoxProfile : FirefoxProfile
{
    public BaseFirefoxProfile()
        : base()
    {
        AcceptUntrustedCertificates = true;
    }
}

When running locally, I get the "Your connection is not secure" message and the test fails. When I debug and view the firefoxprofile, it says AcceptUntrustedCertificates is correctly set to true but it doesnt work

Mike Johnston
  • 237
  • 6
  • 20
  • You can probably find your answer here: https://stackoverflow.com/questions/42583795/selenium-why-setting-acceptuntrustedcertificates-to-true-for-firefox-driver-does – Devin L. Sep 13 '17 at 23:28
  • This links to the GitHub which has an issue that is Closed, but the thread does not indicate it is resolved. There has to be a workaround or a fix. – Mike Johnston Sep 14 '17 at 01:54

0 Answers0