Set Proxy Using WebDriver

I am currently at the London Tester Gathering Workshops in a session being hosted by Bill Matthews. He is showing the attendees how to use Zap Proxy. During the class he mentioned that you can hook your existing WebDriver checks into a proxy. Something I also mentioned in my recent "WebDriver Beyond Checks" post.

So I thought I would create a quick post showing you how you can do this. I am not using Zap, instead I am using Fiddler, but you just need the right proxy url and change accordingly.

Here is how you do it in C# using Firefox and Chrome drivers.
Firefox

Chrome

Here is how you do it in Java.

Firefox

Chrome

There you go, you can now add a proxy to your WebDriver checks, and collate lots of information to explore from various proxies available such as, BrowserMob, Fiddler and ZapProxy.

Happy Proxy-ing.

5 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. I have spent a lot of time browsing for a solution to my problem: I am testing an Android app and will be testing the same app on iOS too very soon, using Appium and C#. My app receives response from the server, which I would want to go through a proxy so that I can sniff as part of my NUnit test to ensure that the response returned from the server is correct and compare it with the response I receive on the app (through SDK).

    I understand I can use BrowserMob (using Automated Tester C# library) to do this on desktop browsers using Selenium but I cant find any info for doing this using Appium. 1. Firstly, is it possible to sniff network traffic going to the mobile app? 2. Are there any other possibilities that I should consider to achieve my goal?

    I want the response to pass through the proxy so that I can assert my tests at run time. Please help/suggest.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete