我的代码如下:
self.current_proxy = {}
self.current_proxy['proxy'] = "proxy:1000"
profile = webdriver.FirefoxProfile()
if 'proxy' in self.current_proxy:
proxy_arr = Common.ic_explode(self.current_proxy['proxy'], ":")
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.http', proxy_arr[0])
profile.set_preference('network.proxy.http_port', int(proxy_arr[1]))
profile.set_preference('network.proxy.ssl', proxy_arr[0])
profile.set_preference('network.proxy.ssl_port', int(proxy_arr[1]))
#profile.set_preference("network.proxy.user_name", 'aaaaa')
#profile.set_preference("network.proxy.password", 'bbbbb')
profile.update_preferences()
self.browser = webdriver.Firefox(profile)
self.browser.set_page_load_timeout(100)
self.browser.implicitly_wait(5)
self.browser.get("http://www.baidu.com")
这两句是不起效果的
#profile.set_preference("network.proxy.user_name", 'aaaaa')
#profile.set_preference("network.proxy.password", 'bbbbb')
请教高手如何做?
感谢分享,我上传完整的代码,并已验证通过的
附上浏览器插件下载地址:https://github.com/mimvp/mimv...