I'm trying to use BrowserMob Proxy
with Selenium
in C#.
I've tried this solution here: http://www.adathedev.co.uk/2012/02/automating-web-performance-stats.html
And my code looks like this:
Server server = new Server(@"path_to\\browsermob-proxy.bat");
server.Start();
Client client = server.CreateProxy();
client.NewHar("test");
var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy };
var profile = new FirefoxProfile();
profile.SetProxyPreferences(seleniumProxy);
IWebDriver driver = new FirefoxDriver(profile);
When I run the test I get the following error:
System.Net.WebException: The remote server returned an error: (404) Not Found.
It fails at the third line.
Any suggestions on how to get this working?
If you can post a more detailed stack trace, that would be useful, along with the remote host you're trying to connect to. In the meantime a few things to try are:
Hope that helps!
This is most likely because your Jetty service is not actually running, did you get a message from BrowserMob batch file saying it couldn't run? In my case it was a situation where the port (by default is set to 8080) but I had something else listening on that port. To fix this, you can pass an optional port number.
var server = new Server(@"C:\path\to\bin\browsermob-proxy.bat", 9090);
I had same problem on python. When I had tried to get content of localhost:8080 I got 404 error. It turned out that my other application was using same 8080 port. So I found PID typing in cmd: netstat -o -n -a | findstr :8080
netstat -o -n -a | findstr :8080
. Then I just terminated process with this PID and browsermob gave me well HAR.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.