Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python webdriver中为ie设置代理?_Python_Selenium_Proxy_Webdriver - Fatal编程技术网

如何在python webdriver中为ie设置代理?

如何在python webdriver中为ie设置代理?,python,selenium,proxy,webdriver,Python,Selenium,Proxy,Webdriver,我正在使用以下代码: 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_prefe

我正在使用以下代码:

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)
在python webdriver中为FireFox设置代理。这适用于FireFox。如何在ie中设置这样的代理

使用:

webdriver.Ie

请看,您必须安装internet Explorer for selenium的webdriver才能使用它

我知道这是一个老问题,但我是这样做的:

caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps["proxy"] = { "proxyType": "manual", "httpProxy": "localhost:8086" }
driver = webdriver.Ie(capabilities = caps)
server.start()
proxy = server.create_proxy()
caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps["proxy"] = { "proxyType": "manual", "httpProxy": proxy.proxy }
driver = webdriver.Ie(capabilities = caps)
如果您使用的是browsermob代理(就像我一样),它会如下所示:

caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps["proxy"] = { "proxyType": "manual", "httpProxy": "localhost:8086" }
driver = webdriver.Ie(capabilities = caps)
server.start()
proxy = server.create_proxy()
caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps["proxy"] = { "proxyType": "manual", "httpProxy": proxy.proxy }
driver = webdriver.Ie(capabilities = caps)

是的,我知道如何使用此代码启动IE,但我不知道如何为IE设置代理。Joe说了什么。这将启动IE,但没有说明如何设置IE的代理(顺便说一句,这只是系统代理…除非您使用的是selenium服务器,否则这是另一个球类游戏),这是原始问题所问的问题。