title: Crawlera/Zyte proxy authentication using C# and Selenium
body: <p>I've tried a number of ways of using Zyte (formally Crawerla) proxies with Selenium.</p>
  <p>They provide
  1- API key (username)
  2- Proxy url/port.</p>
  <p>No password is needed.</p>
  <p>What I have tried...</p>
  <pre><code>    ChromeOptions options = new ChromeOptions();
      var proxy = new Proxy();
      proxy.Kind = ProxyKind.Manual;
      proxy.IsAutoDetect = false;
      proxy.SocksUserName = &quot;&lt;&lt;API KEY&gt;&gt;&quot;;
      proxy.SocksPassword = &quot;&quot;;
      proxy.HttpProxy =
      proxy.SslProxy = &quot;proxy.crawlera.com:8011&quot;;
      options.Proxy = proxy;
      IWebDriver driver = new ChromeDriver(options);
  </code></pre>
  <p>Which, when selenium loads produces this:
  <a href="https://i.stack.imgur.com/rlKK2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rlKK2.png" alt="enter image description here" /></a></p>
  <p>Funnily enough, if I manually add the username (API Key) it will indeed load, but this defeats the purpose of automation.</p>
  <p>The second method I tried was:</p>
  <pre><code>    ChromeOptions options = new ChromeOptions();
      options.AddArguments(&quot;--proxy-server=&lt;API KEY&gt;::proxy.crawlera.com:8011&quot;);
      options.AddArguments(&quot;--log-level=OFF&quot;);
      IWebDriver driver = new ChromeDriver(options);
  </code></pre>
  <p>I used <code>::</code> as the password is blank.</p>
  <p>And the error to this method is:</p>
  <blockquote>
  <p>[46784:44492:0219/015119.757:ERROR:validation_errors.cc(87)] Invalid
  message: VALIDATION_ERROR_DESERIALIZATION_FAILED</p>
  </blockquote>
  <p>I guess Zyte/Crawerla knowledge isn't really needed, it's more how to provide selenium with a username, but no password, and have it use the proxy successfully.</p>
  <p>Does anybody have any idea? (examples appreciated)</p>