browsermob-proxy icon indicating copy to clipboard operation
browsermob-proxy copied to clipboard

HTTPS "not secure" with Chrome

Open PickHub opened this issue 6 years ago • 7 comments

When running the following code, everything works fine, except that left of the URL Chrome displays "Not Secure" on HTTPS sites. How do I get rid of that?

BrowserMobProxy proxy;
WebDriver driver;

proxy = new BrowserMobProxyServer();
proxy.start();

final Proxy seleniumProxy = ClientUtil.createSeleniumProxy( proxy );
final String hostIp = Inet4Address.getLocalHost().getHostAddress();
seleniumProxy.setHttpProxy( hostIp + ":" + proxy.getPort() );
seleniumProxy.setSslProxy( hostIp + ":" + proxy.getPort() );

final FirefoxOptions fOptions = new FirefoxOptions();
fOptions.setCapability( CapabilityType.PROXY, seleniumProxy );
driver = new FirefoxDriver( fOptions );

final Har har = proxy.newHar( "https://google.de/" );
driver.get( "https://google.de/" );

List<HarEntry> entries = proxy.getHar().getLog().getEntries();
for (int i = 0; i < entries.size(); i++) {
      System.out.println("Response status: " + entries.get(i).getResponse().getStatus());
}

final WebElement searchTextField = driver.findElement( By.name( "q" ) );
searchTextField.sendKeys( "foo" );
System.out.println( "### HAR after sendKeys: " + har );
searchTextField.submit();
System.out.println( "### HAR after submit: " + har );

proxy.stop();
driver.close();

I'm using ChromeDriver 2.44.609545 and browsermob-core 2.1.5.

PickHub avatar Jan 08 '19 10:01 PickHub

have you tried fOption.setAcceptInsecureCerts(true) ?

andreabisello avatar Jan 21 '19 10:01 andreabisello

Yes, but the warning still appears.

PickHub avatar Apr 02 '19 08:04 PickHub

ChromeOptions options = new ChromeOptions(); options.setCapability(CapabilityType.PROXY, seleniumProxy); options.addArguments("--ignore-certificate-errors");

--- this is chrome not FirefoxOptions , you can google

endlesshh avatar Dec 24 '19 00:12 endlesshh

this python code works for me:

options = webdriver.ChromeOptions() options.add_extension('../lib/BlazeMeter.crx') options.add_argument('ignore-certificate-errors') options.add_argument("--proxy-server={0}".format(proxy.proxy)) #Configure chrome options driver = webdriver.Chrome("/opt/local/bin/chromedriver",options=options) proxy.new_har("frank")

webloginwu avatar Jul 01 '21 18:07 webloginwu

You may need to import the CA root https://github.com/lightbody/browsermob-proxy#ssl-support

zerowebcorp avatar Mar 31 '22 15:03 zerowebcorp

Silly question but where to import the certificate? With BrowserMob you get the by default the Impersonated Certificate LittleProxy MITM.

The validity period is correct but still the browser (when going to e.g. https://google.com) still mentions not secure

officemb avatar Dec 23 '22 17:12 officemb

@officemb Go chrome://settings/security →【Advanced】→【Manage device certificates】→【Trusted Root Certification Authorities】→ 【import】

HiImHG avatar Jan 05 '23 08:01 HiImHG