how do i set proxy for chrome in python webdriver -
I am using this code: Python webdriver the proxy set to FF. It works for FF How to set proxy in Chrome like this? I found this but not very useful when I run the script nothing happens (the Chrome browser does not start).
Profile = webdriver.FirefoxProfile () Profile . set_preference ( "network.proxy.type", 1) profile.set_preference ( "network.proxy.http", "proxy.server.address") profile.set_preference ( "network.proxy.http_port", "port_number") profile. update_preferences () driver = webdriver.Firefox (firefox_profile = profile)
selenium imports webdriver proxy = "23.23.23.23:3128" # ip: port or Host: Port chrome_options = webdriver.ChromeOptions () chrome_options.add_argument ( '- proxy-server =% s'% proxy) Chrome = webdriver.Chrome (chrome_options = chrome_options) chrome.get ( "http://whatismyipaddress.com")
Comments
Post a Comment