我的问题是关于在 IE 浏览器的 python (3.6) 中设置 selenium 编码的代理。
from selenium import webdriver
PROXY = "94.56.171.137"
PORT = 8080
base_url = "https://google.com"
desired_capability = webdriver.DesiredCapabilities.INTERNETEXPLORER
desired_capability['proxy'] = {
"proxyType": "manual",
"httpProxy": PROXY,
"httpProxyPort": PORT,
"ftpProxy": PROXY,
"ftpProxyPort": PORT,
"sslProxy": PROXY,
"sslProxyPort": PORT,
"class":"org.openqa.selenium.Proxy",
}
driver = webdriver.Ie(executable_path='C:\\tmp\\IEDriverServer',capabilities=desired_capability)
driver.get(base_url)
我收到以下错误消息 -
<p>The following error was encountered while trying to retrieve the URL: <a href="http://127.0.0.1:54684/session">http://127.0.0.1:54684/session</a></p>
我从下面获取了参考 -
https://stackoverflow.com/questions/45949274/setting-proxy-in-selenium-in-python-for-firefox-geckodriver?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
它在 FireFox 浏览器中运行良好,但我无法在 IE 浏览器中运行。