selenium 4.2.0
python 3.10.4
Having issue while trying to set up proxy on gecko driver Firefox using python Tried with
from selenium.webdriver import Firefox
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
profile_path = r'C:\Users\Hodzi\AppData\Local\Mozilla\Firefox\Profiles\dzwrop1t.default-release'
options=Options()
options.set_preference('profile', profile_path)
options.set_preference('network.proxy.type',1)
options.set_preference('network.proxy.http', '154.30.216.64')
options.set_preference('network.proxy.http_port', 8800)
service = Service()
driver = Firefox(service=service, options=options)
driver.get("https://www.whatismyip.com/")
driver.quit()
Output: My regular IP address
In settings I see this.
If I manually check "Also use this proxy for HTTPS!" then it works.
Is it possible to check or set this proxy through code also ?
It looks like you're missing a few preferences for the full proxy setup. Here's the full set that I use for setting a proxy for Firefox WebDriver (Python):
options.set_preference("network.proxy.type", 1)
options.set_preference("network.proxy.http", proxy_server)
options.set_preference("network.proxy.http_port", int(proxy_port))
options.set_preference("network.proxy.ssl", proxy_server)
options.set_preference("network.proxy.ssl_port", int(proxy_port))