Selenium WebDriverException:已达到错误页面

SGA*_*GAO 9 firefox selenium-webdriver django-1.8 python-3.6

我正在关注Django TDD教程:
http://www.marinamele.com/taskbuster-django-tutorial/taskbuster-working-environment-and-start-django-project
运行'all_users.py'时出现以下错误在我启动开发服务器'python manage.py runserver'之前和之后:

回溯(最近一次调用最后一次):文件"functional_tests/all_users.py",第15行,在test_it_worked self.browser.get(' http:// localhost:8000 ')文件"/Users/samgao/.virtualenvs/tb_test/ lib/python3.6/site-> packages/selenium/webdriver/remote/webdriver.py",第264行,在get self.execute(Command.GET,{'url':url})文件"/ Users/samgao/.virtualenvs/tb_test/lib/python3.6/site-> packages/selenium/webdriver/remote/webdriver.py",第252行,执行self.error_handler.check_response(响应)文件"/Users/samgao/.virtualenvs/ tb_test/lib/python3.6/site-> packages/selenium/webdriver/remote/errorhandler.py",第194行,在check_response中引发exception_class(message,screen,stacktrace)selenium.common.exceptions.WebDriverException:消息:已达到错误page:> about:neterror?e = connectionFailure&u = http%3A // localhost%3A8000 /&c = UTF-> 8&f = regular&d = Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20s > erver%20AT%20localhost%3A8000.

基本上无法建立与localhost的连接.
设置和配置与上一个链接中的教程相同.

我已经在这个问题上苦苦挣扎了两天,如果你能提供任何帮助,我会非常友好地感谢你.

小智 6

我遇到了同样的错误,为我解决的是从localhost更改为127.0.0.1

  • 旧的self.browser.get('http://localhost:8000')

  • 更好self.browser.get('http://127.0.0.1:8000')


Kyl*_*erg 0

因为这是“服从测试山羊”的快照(大约 Django 1.8 的时间)——也许那里的说明不再相关。我建议直接进入山羊嘴并重新开始!

该问题可能与 virtualenvwrapper (不再需要)有关,也可能与您尝试访问的端口/地址有关。根据您的 Selenium 和 Firefox 版本,也可能存在与此相关的问题