仅在特定网页

时间:2017-08-09 21:26:26

标签: python selenium selenium-webdriver geckodriver

我正在尝试创建一个内容抓取工具来收集医疗术语列表,我正在使用https://www.merriam-webster.com/browse/medical执行该任务。我现在所有的代码都是:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("https://www.merriam-webster.com/browse/medical/a")
driver.close()

使用此网址或任何https://www.merriam-webster.com网址,每次运行程序后都会显示以下错误消息:

Traceback (most recent call last):
  File "mw-download.py", line 5, in <module>
    driver.get("https://www.merriam-webster.com/browse/medical/a")
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 268, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=https%3A//nop.xpanama.net/if.html%3Fadflag%3D1%26cb%3DKHg6C73w9F&c=UTF-8&f=regular&d=Firefox%20can%E2%80%99t%20find%20the%20server%20at%20nop.xpanama.net.

我尝试将网址更改为不同的网站,有和没有https支持,以测试它是否是https的内容,但我没有遇到任何其他网站的此错误。我还尝试删除脚本末尾的driver.close()命令,以查看在加载页面内容之前是否尝试关闭驱动程序是导致问题的原因,但即使没有该行代码,问题仍然存在。

任何帮助理解此错误并修复它将非常感谢!

0 个答案:

没有答案