我用Selenium+Python浏览互联网。 不幸的是,在我的公司,它不能与internetexplorer一起工作(但它可以与Chrome一起工作),这肯定是因为我的公司有一个代理,并且需要使用PAC文件来浏览互联网。在
这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.proxy import ProxyType
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.ie.webdriver import WebDriver as Ie
ie_path=...
url_of_the_pac_file=...
caps = DesiredCapabilities.INTERNETEXPLORER
caps["proxy"] = {"proxyType": "pac","proxyAutoconfigUrl": url_of_the_pac_file}
driver=Ie(executable_path=ie_path,capabilities=caps,port=8080)
driver.get("http://www.google.com")
每次运行此代码时,我都会收到以下消息:
^{pr2}$这似乎需要我的证书,但我不知道怎么做。 谢谢你的帮助!在
如果您使用的是Python2.7,可以使用以下代码在浏览器上禁用代理设置。在
相关问题 更多 >
编程相关推荐