Capturing HTTP request with BrowserMob Proxy

354 views
Skip to first unread message

Mohd Shahid

unread,
Jun 18, 2019, 7:03:34 AM6/18/19
to BrowserMob Proxy
I had compiled my code successfully by using BrowsermMob Proxy and able to get the Requests and Response URLs on the web application in HAR(HTTP Archive) file. But I think I am not able to get the request which I needed.

What I need is to get only the request's URL of the particular button or span which I click at the time of testing.
Is there any method of doing of BrowserMob Proxy?


Thanks and Regards,
Mohd Shahid
Intern at MakeMyTrip

Sheripally Ramesh

unread,
Jan 10, 2020, 7:12:47 AM1/10/20
to BrowserMob Proxy
Hi Shahid,
I need your help in this.
I got a new task assigned to me by my customer wherein I need to capture network traffic on selenium grid(using java).
I am very new to this.

Can you kindly help me on this?
If possible, can you kindly call me at +91 950 273 4834 or provide me your contact number so that I can complete this task within time.

Best Regards,
Ramesh SP
M : +91 950 273 4834

Mohd Shahid

unread,
Jan 10, 2020, 11:37:34 AM1/10/20
to browserm...@googlegroups.com
Hi,
Did you implemented and read the documentation of BrowserMobProxy?
I hope you already tried this code :
public void setUp(String pageRef, String url){
        proxy = new BrowserMobProxyServer();
        proxy.setTrustAllServers(true);
        proxy.start();

        ChromeOptions options = new ChromeOptions();
        options.addArguments("--disable-notifications");
        Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
        DesiredCapabilities capabilities = new DesiredCapabilities();

        capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
        capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        capabilities.setAcceptInsecureCerts(true);

        System.setProperty("webdriver.chrome.driver", driverPath);

        driver = new ChromeDriver(capabilities);
        JavascriptExecutor js = (JavascriptExecutor) driver;
        proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT);

        proxy.newHar(pageRef);

        driver.get(url);
        driver.manage().timeouts().pageLoadTimeout(15, TimeUnit.SECONDS);

    }

    public void tearDown(String FileName) {
        Har har = proxy.getHar();

        File harFile = new File(FileName);

        try {
            har.writeTo(harFile);

        } catch (IOException e) {
            System.out.println("Could not find file " + FileName);
        }
       if (driver != null) {
           proxy.stop();
           driver.quit();
       }
    }


--

---
You received this message because you are subscribed to the Google Groups "BrowserMob Proxy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/browsermob-proxy/da38628d-14a3-4d44-a441-709328caa759%40googlegroups.com.

Sheripally Ramesh

unread,
Jan 22, 2020, 7:25:04 AM1/22/20
to BrowserMob Proxy
Hi Shahid,

Thank you for your time.

We are completely got struck up. Kindly help us by letting us know if we are doing any mistake and guide us in right direction, please.

We are using BrowserMob Proxy 2.1.5 and executed using Maven. Please find attached the screenshot-1 of our BrowserMobProxy project whch we ran and thorwn error as shown in yellow color. The error whch we are getting is shown in screenshot-2.

screenshot-1.PNG

screenshot-2.PNG


If possile,kindly call me at my mobile +91 950 273 4834..

Best Regards,
Ramesh 
To unsubscribe from this group and stop receiving emails from it, send an email to browserm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages