browsermob-proxy
browsermob-proxy copied to clipboard
HTTPS "not secure" with Chrome
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.
have you tried fOption.setAcceptInsecureCerts(true) ?
Yes, but the warning still appears.
ChromeOptions options = new ChromeOptions(); options.setCapability(CapabilityType.PROXY, seleniumProxy); options.addArguments("--ignore-certificate-errors");
--- this is chrome not FirefoxOptions , you can google
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")
You may need to import the CA root https://github.com/lightbody/browsermob-proxy#ssl-support
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 Go chrome://settings/security →【Advanced】→【Manage device certificates】→【Trusted Root Certification Authorities】→ 【import】