Add proxy to PhantomJSDriver (Selenium C#)

后端 未结 2 902
刺人心
刺人心 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 23:01

    You can use the CapabilityType class to set the proxy capability. Here is a modified version of your code above:

    PhantomJSOptions phoptions = new PhantomJSOptions();
    
    phoptions.AddAdditionalCapability(CapabilityType.Proxy, "http://localhost:9999");
    
    driver = new PhantomJSDriver(phoptions);
    

    This worked for me. Arran's answer did not work for me. For some reason, my PhantomJSDriverService class did not have a ProxyType or Proxy member.

提交回复
热议问题