0

Using Selenium and the web driver to drive phantomjs as part of a web scraping project. From the "Known Issues" for Windows at PhantomJS, it is suggested that the proxy-type be set to "none" to speed up network performance.

I tried the following:

PhantomJSOptions options = new PhantomJSOptions();
options.AddAdditionalCapability("proxy", "{proxyType:none}");

However, this sets proxy to a string and I think I need a json object. Can someone show me how to do this correctly?

Wavel
  • 956
  • 8
  • 31

1 Answers1

1

Use the driver service to set options:

var phantomJSDriverService = PhantomJSDriverService.CreateDefaultService(phantomJsDir);
phantomJSDriverService.ProxyType = "none";
var driver = new PhantomJSDriver(phantomJSDriverService);
John Nilsson
  • 17,001
  • 8
  • 32
  • 42
  • The docs didn't show ProxyType as a property. Thanks for the info. Now if only you had some ideas on how to make it more stable! Crashes after a handful of GoToUrl(page)'s. – Wavel Jun 10 '13 at 19:34
  • I can now answer the crashes question... upgrade to phantomjs.exe 1.9.1 and all is great. No crashes after 30 minutes of running so far. – Wavel Jun 10 '13 at 21:29