0

I got the same problem like a lot of people, my test cases are not running with Firefox because of the insecure password warning. I tried a lot of "solutions" from Stackoverflow and Google but nothing solved it for me, so maybe you can help me!

I'm running mvn, TestNg, Parallel tests and all with grid and docker. All solutions i tried (Firefox Profile, capabilities...etc) lead into remote driver is not starting anymore.

Here is my code:

public void setUp(String myBrowser) throws MalformedURLException 
{
    driver = new RemoteWebDriver(newURL("http://0.0.0.0:4444/wd/hub"),getBrowserCapabilities(myBrowser));
 }


private static DesiredCapabilities getBrowserCapabilities(String browserType) 
{
      DesiredCapabilities capabillities = null;

    switch (browserType) 
    {
        case "firefox":
            System.out.println("Opening firefox driver");
            capabillities=new DesiredCapabilities().firefox();
            return capabillities;

        case "chrome":
            System.out.println("Opening chrome driver");
            capabillities=new DesiredCapabilities().chrome();
            return capabillities;

        case "IE":
            System.out.println("Opening IE driver");
            capabillities=new DesiredCapabilities().internetExplorer();
            return capabillities;

        default:
            System.out.println("browser : " + browserType + " is invalid, Launching Chrome as browser of choice..");
            capabillities=new DesiredCapabilities().chrome();
            return capabillities;
    }
}
NarendraR
  • 7,577
  • 10
  • 44
  • 82
Brenner
  • 1
  • 3
  • 1
    Your code has nothing to do with your problem? Please post some screenshot of the issue and also post line of code where issue happens – Tarun Lalwani Aug 12 '17 at 21:28
  • Hey, sorry I think I described it wrong. This code is running and the test case as well. But I'm using a login over http and on login button this window pops up ![password warning ](https://i.stack.imgur.com/H9uc4.png). While this window pops up the test case failed because of an exception gets thrown and test is clicking on login button and a the Firefox more information tab opens. – Brenner Aug 12 '17 at 21:36
  • So the click doesn't error out but it opens what you would have got on Learn more? – Tarun Lalwani Aug 12 '17 at 21:39
  • I need a way to disable the insecure the Firefox password warning. All I find with google is not working, so I'm looking for a solution which would fit in the code I posted. The test cases are running fine with other browsers. This one is showing on learn more https://support.mozilla.org/en-US/kb/insecure-password-warning-firefox – Brenner Aug 12 '17 at 21:43
  • As @TarunLalwani mentioned your code have nothing to do with the issue you are facing. Edit the question as per the issue you are facing with proper error & screenshot for further analysis. – undetected Selenium Aug 13 '17 at 10:44

3 Answers3

0

You need to create Firefox profile and set security.insecure_password.ui.enabled to false

FirefoxProfile firefoxProfile=new FirefoxProfile();
firefoxProfile.setPreference("security.insecure_password.ui.enabled",false);
firefoxProfile.setPreference("security.insecure_field_warning.contextual.enabled",false);

WebDriver driver=new FirefoxDriver(firefoxProfile); 

This will make sure you don't get the warning

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • I'll tried this solution, but when I build it in my code (see code in post) the driver is not starting anymore. Maybe I did it totally wrong. Do you know how to set it up in my code structure? – Brenner Aug 12 '17 at 22:02
0

Okay, thanks guys now it is working like i want :) Im not really sure why but with this CodeSnippet the warning is not showing up anymore. Setting up a firefox Profile without more information worked.

  capabillities = new DesiredCapabilities().firefox();
  FirefoxProfile profile = new FirefoxProfile();
  capabillities.setCapability(FirefoxDriver.PROFILE , profile);
  return capabillities;
Brenner
  • 1
  • 3
0

I was facing the similar problem. Adding below code to the capability works for me.

            FirefoxProfile profile = new FirefoxProfile();

            profile.setPreference("pdfjs.disabled", true);
            profile.setPreference("security.insecure_password.ui.enabled", false);
            profile.setPreference("security.insecure_field_warning.contextual.enabled", false);

           capabilities.setCapability(FirefoxDriver.PROFILE, profile);
hemanto
  • 1,900
  • 17
  • 16