Prakash Bethapudi
Prakash Bethapudi

Reputation: 23

How to use only Socks Proxy in Firefox using Selenium?

i'm writing tests in selenium and tried to use only socks for proxy. Here is the code.

from selenium import webdriver
proxy = "localhost"
port = "5900"
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.socks", proxy)
profile.set_preference("network.proxy.socks_port", port)
profile.update_preferences()
driver = webdriver.Firefox(executable_path="C:\Program Files\MozillaFirefox\geckodriver\geckodriver.exe", firefox_profile=profile)
driver.get("https://[xxx:xxx:xxx:xxx]")

But when I checked in Firefox. the proxy is set for all HTTP, FTP, etc instead of only Socks. Here is the image Example

I know I am missing something Basic here. What is it?

Upvotes: 1

Views: 415

Answers (1)

Oleg Glazunov
Oleg Glazunov

Reputation: 23

profile.set_preference("network.proxy.socks_port", int(port))

Upvotes: 1

Related Questions