title: Configure proxy settings Selenium Firefox
body: <p>I've been trying for about 2 days to use selenium with a proxy server but have still not been able to do it. I have tried the method from the selenium website, copy and pasting but it didn't work. I've tried all of the answers from Stackoverflow but none of them worked, the closest I got was loading the page but my IP stayed the same.</p>
  
  <p>Here is the code I tried most recently:</p>
  
  <pre><code>#!/usr/bin/env python
  
  from selenium import webdriver
  from selenium.webdriver.common.proxy import Proxy, ProxyType
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  
  
  
  HOST = "144.217.31.225"
  PORT = "3128"
  def my_proxy(PROXY_HOST,PROXY_PORT):
          fp = webdriver.FirefoxProfile()
          # Direct = 0, Manual = 1, PAC = 2, AUTODETECT = 4, SYSTEM = 5
          print PROXY_PORT
          print PROXY_HOST
          fp.set_preference("network.proxy.type", 1)
          fp.set_preference("network.proxy.http",PROXY_HOST)
          fp.set_preference("network.proxy.http_port",int(PROXY_PORT))
          fp.set_preference("general.useragent.override","whater_useragent")
          fp.update_preferences()
          return webdriver.Firefox(firefox_profile=fp)
  
  browser = my_proxy(HOST,PORT)
  browser.get('https://www.google.com')
  
  search=browser.find_element_by_xpath("//input[@title='Search']")
  search.send_keys('my ip')
  </code></pre>
  
  <p>This is the error I received:</p>
  
  <pre><code>3128
  144.217.31.225
  Traceback (most recent call last):
    File "./script.py", line 32, in &lt;module&gt;
      search=browser.find_element_by_xpath("//input[@title='Search']")
    File "/home/matt/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 313, in find_element_by_xpath
      return self.find_element(by=By.XPATH, value=xpath)
    File "/home/matt/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 791, in find_element
      'value': value})['value']
    File "/home/matt/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
      self.error_handler.check_response(response)
    File "/home/matt/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@title='Search']
  </code></pre>
  
  <p>It manages to load the page but fails to enter the text in the search bar. I manually take over and type 'my IP' in the search bar but the IP hasn't changed.</p>