i am trying to run webdriver.Firefox() using proxy i seached for multiple solutions and each time i check my ip there is no change , one solution worked for me which is :
def install_proxy(PROXY_HOST,PROXY_PORT): fp = webdriver.FirefoxProfile() 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("network.proxy.https",PROXY_HOST) fp.set_preference("network.proxy.https_port",int(PROXY_PORT)) fp.set_preference("network.proxy.ssl",PROXY_HOST) fp.set_preference("network.proxy.ssl_port",int(PROXY_PORT)) fp.set_preference("network.proxy.ftp",PROXY_HOST) fp.set_preference("network.proxy.ftp_port",int(PROXY_PORT)) fp.set_preference("network.proxy.socks",PROXY_HOST) fp.set_preference("network.proxy.socks_port",int(PROXY_PORT)) fp.set_preference("general.useragent.override","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A") fp.update_preferences() return webdriver.Firefox(firefox_profile=fp)
problem is , when i run it IDLE frozen and cant take commands for seconds then i get this Error :
Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> ee = webdriver.Firefox() File "C:\Program Files (x86)\python3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__ keep_alive=True) File "C:\Program Files (x86)\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__ self.start_session(capabilities, browser_profile) File "C:\Program Files (x86)\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 245, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Program Files (x86)\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 314, in execute self.error_handler.check_response(response) File "C:\Program Files (x86)\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: InvalidArgumentError: Expected "socksVersion" to be a positive integer, got [object Undefined] undefined