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

Cannot get browsermob to return the entries

Open jfkhoury opened this issue 7 years ago • 2 comments

  • Running Selenium server locally on port 4444
  • Running Browsermob on port 8080 (default)
  • Using selenium-webdriver npm package to run my selenium tests for the Firefox browser
  • Calling the cbHAR by setting captureContent, captureHeaders and captureBinaryContent to true.
  • Running a local express server and pointing the proxy and selenium to that server: 127.0.0.1:9191 (I even tried a regular domain like yahoo.com)

No matter what I try, the entries are always empty.

Here's a code snippet:

    proxy.cbHAR({
            name: "http://" + LOCAL_SERVER_URL,
            captureContent: true,
            captureHeaders: true,
            captureBinaryContent: true
        },
        runSeleniumScripts,
        function (error, data) {
            console.log("DATA:", data);
            // NOTE: data.entries is always an empty array!!
        });

        function runSeleniumScripts(proxy, callback) {
            var driver = 
                new selenium.Builder()
                    .usingServer('http://localhost:4444/wd/hub')
                    .forBrowser('firefox')
                    .setProxy(proxy)
                    .build();

            driver.get("http://" + LOCAL_SERVER_URL).then(callback).then(done);
        }

jfkhoury avatar Mar 14 '17 17:03 jfkhoury

@jfkhoury Have you figured out what's wrong? It looks like I'm stuck with the same problem.

shkaper avatar Mar 30 '17 21:03 shkaper

@shkaper It was too painful to deal with all those tools, servers and configurations. So I switched tools and built a small mini-framework on top of them, working perfectly, with no servers required. I am using the following:

  • CasperJS
  • SlimerJS as engine
  • Wrote a little node runner + mini framework to abstract the painful parts and configure those tools the write way to enable a proxy that spits out responses' bodies.

I might open source the whole project, not sure yet.

Please let me know if you need more details. Good Luck!

jfkhoury avatar Apr 03 '17 18:04 jfkhoury