一、FireFox浏览器
1 myProxy = "60.195.250.55:80" 2 proxy = Proxy({ 3 'proxyType': ProxyType.MANUAL, 4 'httpProxy': myProxy, 5 'ftpProxy': myProxy, 6 'sslProxy': myProxy, 7 'noProxy': '' 8 }) 9 driver = webdriver.Firefox(proxy=proxy)
二、Phantomjs
service_args = [ '--proxy=60.195.250.55:80', '--proxy-type=socks5', ] driver = webdriver.PhantomJS(executable_path='D:\phantomjs-2.1.1-windows\phantomjs.exe',service_args=service_args)
无论如何,记得先确保代理服务器能用,否则都是徒劳