title: Selenium Chrome & Firefox WebDriver: Set HTTPS proxy in Python
body: <p>I've done plenty of searching however there is a lot of confusing snippets out there that are very similar.</p>
  <p>I've attempted to use the <code>DesiredCapabilities</code>, <code>ChromeOptions</code>, <code>Options</code> and a series of arguments but nothing is working :( It fails to set a proxy.</p>
  <p>For example (<code>ChromeOptions</code>)</p>
  <pre><code>chrome_options = webdriver.ChromeOptions()
  chrome_options.add_argument('--proxy=https://' + proxy_ip_and_port)
  chrome_options.add_argument('--proxy-auth=' + proxy_user_and_pass)
  chrome_options.add_argument('--proxy-type=https')
  
  browser = webdriver.Chrome(&quot;C:\drivers\chromedriver.exe&quot;)
  </code></pre>
  <p>Another example (<code>Options</code>)</p>
  <pre><code>    options = Options()
      options.add_argument('--proxy=https://' + proxy_ip_and_port)
      options.add_argument('--proxy-auth=' + proxy_user_and_pass)
      options.add_argument('--proxy-type=https')
  
      browser = webdriver.Chrome(&quot;C:\drivers\chromedriver.exe&quot;, chrome_options=options)
  </code></pre>
  <p>I've also used <code>--proxy-server</code> instead of <code>--proxy-auth</code>, <code>--proxy-type</code>... etc even in the format of: <code>'--proxy-server=http://' + proxy_user_and_pass + '@' + proxy_ip_and_port</code></p>
  <p>Another example (<code>DesiredCapabilities</code>)</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  
  capabilities = dict(DesiredCapabilities.CHROME)
  capabilities['proxy'] = {'proxyType': 'MANUAL',
                           'httpProxy': proxy_ip_and_port,
                           'ftpProxy': proxy_ip_and_port,
                           'sslProxy': proxy_ip_and_port,
                           'noProxy': '',
                           'class': &quot;org.openqa.selenium.Proxy&quot;,
                           'autodetect': False}
  
  capabilities['proxy']['socksUsername'] = proxy_user
  capabilities['proxy']['socksPassword'] = proxy_pass
  
  browser = webdriver.Chrome(executable_path=&quot;C:\drivers\chromedriver.exe&quot;, desired_capabilities=capabilities)
  </code></pre>
  <p>I've tried in Firefox too but the same issue happens, it uses the browser with my normal IP.</p>