Add proxy to PhantomJSDriver (Selenium C#)

后端 未结 2 904
刺人心
刺人心 2021-01-15 22:10

I\'d like to listen to traffic generated by phantomjs selenium driver in c#. The below code does not work unfortunately!

PhantomJSOptions phoptions = new Ph         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-15 22:49

    Proxy proxy = new Proxy();
    proxy.HttpProxy = string.Format("127.0.0.1:9999");
    var service = PhantomJSDriverService.CreateDefaultService();
    service.ProxyType = "http";
    service.Proxy = proxy.HttpProxy;
    IWebDriver driver = new PhantomJSDriver(service);
    

    Some quick testing showed this work for me.

提交回复
热议问题