我正在尝试在 Windows 上使用硒。每当我运行此代码时:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
path = "C:/Users/User/Webdriver/chromedriver.exe"
driver = webdriver.Chrome(chrome_options=options, executable_path=path)
driver.get("http://www.python.org")
我收到以下错误。我真的不明白这个问题。我没有使用代理或类似的东西。因此,我认为这与我的网络无关,但我可能完全错了。
in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: <HTML><HEAD>
<TITLE>Network Error</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Network Error (dns_unresolved_hostname)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
Your requested host "localhost" could not be resolved by DNS.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
For assistance, contact your network support team.
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>```