title: How to use Selenium with Firefox Proxy in Selenium 4.x
body: <p>I need to pass through options as profiles are deprecated.
  I am trying to use FF to proxy to a secure browser. However, I ran into a problem, which is described below:</p>
  <p>My code:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.by import By
  from webdriver_manager.firefox import GeckoDriverManager
  from selenium.webdriver.firefox.service import Service
  from selenium.webdriver.firefox.options import Options as FirefoxOptions
  from selenium.webdriver.common.proxy import Proxy, ProxyType
  
  socks = '127.0.0.1:9050'
  profile_path = '~/Library/Application\ Support/TorBrowser-Data/Browser/tjv18qgq.default'
  capabilities = webdriver.DesiredCapabilities.FIREFOX
  proxy = Proxy({
      &quot;proxyType&quot;: 'manual',
      &quot;httpProxy&quot;: socks,
      &quot;sslProxy&quot;: socks,
      &quot;noProxy&quot;: ''
  })
  proxy.add_to_capabilities(capabilities)
  options = FirefoxOptions()
  options.headless = False
  options.set_preference('profile', profile_path)
  options.set_capability(&quot;proxy&quot;, proxy)
  service = Service(executable_path=GeckoDriverManager().install())
  driver = webdriver.Firefox(service=service, options=options)
  
  driver.get('https://check.torproject.org/')
  element = driver.find_element(By.TAG_NAME, 'h1')
  if element.text == 'Sorry. You are not using Tor.':
      print('Not connected')
      driver.close()
  </code></pre>
  <p>My output:</p>
  <pre><code>====== WebDriver manager ======
  Current firefox version is 95.0
  Get LATEST geckodriver version for 95.0 firefox
  Driver [/Users//.wdm/drivers/geckodriver/macos/v0.30.0/geckodriver] found in cache
  Traceback (most recent call last):
    File &quot;/Users//dev/awesomeCRM/Backend/octopus-py/main.py&quot;, line 23, in &lt;module&gt;
      driver = webdriver.Firefox(service=service, options=options)
    File &quot;/Users//dev/awesomeCRM/Backend/octopus-py/venv/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py&quot;, line 179, in init
      RemoteWebDriver.__init__(
    File &quot;/Users//dev/awesomeCRM/Backend/octopus-py/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 268, in init
      self.start_session(capabilities, browser_profile)
    File &quot;/Users//dev/awesomeCRM/Backend/octopus-py/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 356, in start_session
      w3c_caps = _make_w3c_caps(capabilities)
    File &quot;/Users//dev/awesomeCRM/Backend/octopus-py/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 102, in _make_w3c_caps
      if caps.get('proxy') and caps['proxy'].get('proxyType'):
  AttributeError: 'Proxy' object has no attribute 'get'
  </code></pre>