How can I disable the mixed content for the selenium ChromeDriver?

35 Views Asked by At

I have a website that I am doing automation testing using Selenium web driver, Java. The site has mixed content problem as it uses both HTTP and HTTPS. Now before initializing ChromeDriver, I want to disable the mixed content. can someone be of an assistance?

FYI: I have successfully disabled it on firefox geckodriver as follows:

FirefoxProfile firefoxprofile=new FirefoxProfile();
firefoxprofile.setPreference("security.mixed_content.block_active_content",false);
firefoxprofile.setPreference("security.mixed_content.block_display_content",false);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxprofile);
driver = new FirefoxDriver(firefoxOptions);

can I do the same while using ChromeDriver?

1

There are 1 best solutions below

0
Habi On

After a long search, I am able to resolve it using just a single line of code

ChromeOptions options = new ChromeOptions();
options.addArguments("--allow-running-insecure-content"); //This resolved mixed content
driver = new ChromeDriver(options);