Selenium(Chrome) and browsermob doesn't work for HTTPS

88 views
Skip to first unread message

Mohd Shahid

unread,
Jul 3, 2019, 7:23:19 AM7/3/19
to Selenium Users

I have been trying to integrate BrowserMob to my selenium tests. It works fine with the website that works on HTTP, but with https websites, the browsers stop working and the HAR file doesn't contain any requests.

When navigating to an https site I get this error on the browser.

"There is something wrong with the proxy server or the address is incorrect."

Here is my code.


@Test
  public void browsermobtest() {


    proxy.start(9091);

    // get the Selenium proxy object
    Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);


    // configure it as a desired capability
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
    System.setProperty("webdriver.chrome.driver", "C:/Users/Madis/Documents/chromedriver.exe");

    WebDriver driver = new ChromeDriver(capabilities);

    // enable more detailed HAR capture, if desired (see CaptureType for the complete list)
    proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);

    // create a new HAR with the label "google.com"
    proxy.newHar("http://www.google.com/");

    // open google.com
    driver.get("https://www.google.ee/#gfe_rd=cr");
    driver.findElement(By.cssSelector("#gb_70")).click();



  }

  @AfterMethod
  public void Afterthetest() {

    // get the HAR data
    Har har = proxy.getHar();

    File harFile = new File("C:/Users/Madis/Documents/har.har");
    try {
      har.writeTo(harFile);
    } catch (IOException e) {
      e.printStackTrace();
    }

  }
}

Mark Collin

unread,
Jul 5, 2019, 6:57:06 AM7/5/19
to Selenium Users
Have a look at the BrowserUp proxy.  It's a fork of the BrowserMob one that is currently maintained and has better SSL support:

⇜Krishnan Mahadevan⇝

unread,
Jul 5, 2019, 7:26:56 AM7/5/19
to Selenium Users
Mark,

So BMP has been shelved is it?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8a6cc1d9-a74e-4208-9245-02ffe36d4230%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Collin

unread,
Jul 5, 2019, 9:55:46 AM7/5/19
to Selenium Users

https://github.com/lightbody/browsermob-proxy

There haven't been any commits for 2 years so I assume so.

BrowserUp looks to be actively maintained at the moment.

⇜Krishnan Mahadevan⇝

unread,
Jul 5, 2019, 10:41:28 AM7/5/19
to Selenium Users
True. After Patrick announced that he would no longer be able to support the BMP library I think Jason took over and was maintaining it. But yeah as you said, there hasn't been much of an activity there. The last commit on BMP was back in Sept 2017. So I think there's a good chance that it got shelved.
Thanks for sharing that alternative. I wasn't aware of BrowserUp.
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Mohd Shahid

unread,
Jul 5, 2019, 2:43:56 PM7/5/19
to Selenium Users
So can I solve my problem by using BrowserUp? 
Because there is no certificates on this - https://github.com/browserup/browserup-proxy#ssl-support 


On Friday, July 5, 2019 at 8:11:28 PM UTC+5:30, Krishnan Mahadevan wrote:
True. After Patrick announced that he would no longer be able to support the BMP library I think Jason took over and was maintaining it. But yeah as you said, there hasn't been much of an activity there. The last commit on BMP was back in Sept 2017. So I think there's a good chance that it got shelved.
Thanks for sharing that alternative. I wasn't aware of BrowserUp.
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


On Fri, Jul 5, 2019 at 7:26 PM Mark Collin <fyre...@gmail.com> wrote:

https://github.com/lightbody/browsermob-proxy

There haven't been any commits for 2 years so I assume so.

BrowserUp looks to be actively maintained at the moment.

On Friday, 5 July 2019 12:26:56 UTC+1, Krishnan Mahadevan wrote:
Mark,

So BMP has been shelved is it?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.

Joe Ward

unread,
Jul 5, 2019, 4:18:34 PM7/5/19
to seleniu...@googlegroups.com
Are you talking about the fact that this links in https://github.com/browserup/browserup-proxy#ssl-support don't lead anywhere?

Why not just navigate to the where it tells you to look, e.g. See the README file in the mitm module for instructions on generating or using your own root certificate and private key with MITM.


To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages