Run proxy with selenium test on different machine

1 posts, 0 answers
  1. Alexander
    Alexander avatar
    2 posts
    Member since:
    Dec 2016

    Posted 13 Dec 2016 Link to this post

    I want to run a selenium test on my local machine and catch http traffic on different machine.
    This is my script:

    RemoteWebDriver driver;
    ChromeOptions chromeOptions = new ChromeOptions();
    FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default);
    OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
    proxy.HttpProxy = "{IP of the different machine}:8888";
    chromeOptions.Proxy = proxy;
    DesiredCapabilities capabilities = (DesiredCapabilities)chromeOptions.ToCapabilities();
    driver = new RemoteWebDriver(new Uri({IP of the different machine}:4444/wd/hub), capabilities, TimeSpan.FromSeconds(600));
    FiddlerApplication.AfterSessionComplete += CollectDataThroughProxy;

    private static List<string> dataStr = new List<string>();

    private static void CollectDataThroughProxy(Session sess)
                if (sess == null || sess.oRequest == null || sess.oRequest.headers == null)
                string headers = sess.oRequest.headers.ToString();
                var reqBody = sess.GetRequestBodyAsString();

    When I change IP in the code and run it on my local machine, it works fine. However, when I change IP to different machine, I see the relevant page is open,but I don't get the http traffic from this machine.
    I checked "allow remote computers to connect" in Fiddler options.

    Can anyone please help me?
Back to Top