开发者

Fiddler doesn't capture traffic from Chrome

开发者 https://www.devze.com 2023-02-28 07:16 出处:网络
Here is what I have to do : Open a url in IE/Chrome/Firefox browser. Do some UI user action (click/submit).

Here is what I have to do :

  1. Open a url in IE/Chrome/Firefox browser.
  2. Do some UI user action (click/submit).
  3. Record http request for a particular http call.

Here is what I did: console application + selenium RC to open url & do the user actions + Fiddler Core to capture that http traffic.

My code works fine when I'm running it in Firefox & IE, but don't know why Fiddler Core not able to capture any http traffic when running it against Chrome.

        ISelenium selenium = new DefaultSelenium("localhost开发者_运维技巧", 4444, "*googlechrome", "http://money.msn.com/");
        selenium.Start();
        selenium.Open("/");
        selenium.WaitForPageToLoad("30000");

Another intersting thing, if I dont use Selenium RC & open Chrome using Process class then I can see fiddler core capturing that http request. But I need a UI automation tool to do the user actions.

Any help will be greatly appriciated.

Thanks.


I hope I do not misinterpret the problem -- I assume localhost traffic to be the thing that cannot be captured.

localhost traffic is routed via the local loopback interface (a 'virtual' interface that routes local traffic more efficiently), and this never reaches a network card. Most packet capture tools capture the packets on the network device driver layer and thus only capture packets that actually go throug physical network devices.


I use the following way to pass proxy and it is working for me.

ChromeOptions options = new ChromeOptions();
options.AddArgument(string.Format("--proxy-server=http={0}:{1};https={0}:{1}", proxyHost, port));
driver = new ChromeDriver(options);


Anyway, use ipv4.fiddler instead of localhost to ensure fiddler is able to capture the traffic.

For IE, if you are using IE9, it has been changed to allow proxy connections to localhost. It seems FF is also capable to do this. Check this URL:

Fiddler and the IE9 Release Candidate http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx

*IE9 RC introduces the ability to proxy loopback traffic. To do so, simply include the token <-loopback> (pronounced “minus-loopback”) in the proxy bypass list. When WinINET encounters this token in the bypass list, it will remove the loopback addresses (localhost, 127.0.0.1) from the list of hosts that bypass the proxy. Fiddler 2.3 and above automatically set this option when capturing traffic.

The FiddlerHook add-on automatically sets the equivalent version of this option for Firefox; for Opera, you can manually remove loopback addresses from the proxy-bypass list.*

0

精彩评论

暂无评论...
验证码 换一张
取 消