mardi 19 juillet 2016

python selenium proxys in chrome/phantomjs

I've tried to use proxy s in chrome but, I get this error.

    driver = webdriver.Chrome(proxy=proxy)
TypeError: __init__() got an unexpected keyword argument 'proxy'

This is the code I am trying to use but it only works with FireFox, so I was wondering if it is possible to do this with phatom JS and chrome

from selenium.webdriver.common.proxy import *
from selenium import webdriver
myProxy = "31.28.244.230:41905"

proxy = Proxy({
    'proxyType': ProxyType.MANUAL,
    'httpProxy': myProxy,
    'ftpProxy': myProxy,
    'sslProxy': myProxy,
    'noProxy': '' # set this value as desired
    })

driver = webdriver.Chrome(proxy=proxy)

driver.get("http://ipchicken.com/")

Aucun commentaire:

Enregistrer un commentaire