Selenium WebDriverException: Reached error page
Asked Answered
D

9

13

I am following a Django TDD tutorial at:
http://www.marinamele.com/taskbuster-django-tutorial/taskbuster-working-environment-and-start-django-project
I get the following error when running 'all_users.py' before and after I start the development server 'python manage.py runserver':

Traceback (most recent call last): File "functional_tests/all_users.py", line 15, in test_it_worked self.browser.get('http://localhost:8000') File "/Users/samgao/.virtualenvs/tb_test/lib/python3.6/site->packages/selenium/webdriver/remote/webdriver.py", line 264, in get self.execute(Command.GET, {'url': url}) File "/Users/samgao/.virtualenvs/tb_test/lib/python3.6/site->packages/selenium/webdriver/remote/webdriver.py", line 252, in execute self.error_handler.check_response(response) File "/Users/samgao/.virtualenvs/tb_test/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=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.

Basically the connection to localhost cannot be established.
The settings and configurations are identical to the tutorial in the previous link.

I have been struggling with the issue for two days, and would thank you most kindly if you could provide any help.

Daubigny answered 5/5, 2017 at 20:6 Comment(0)
B
9

I got the same error and what solved for me was changing from localhost to 127.0.0.1:

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

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

Bernardabernardi answered 17/2, 2019 at 16:11 Comment(1)
This worked for me. I had the virtualenv activated, django server running, but still got the error. Firefox starts up, tries to access http://localhost:8000, and fails, so selenium raises an exception. But when I refresh the browser manually, the page loads. If I change the code to do self.browser.get('http://127.0.0.1:8000'), as you suggest, the page loads first time, no exception is thrown and the test passes. Weird. I wonder if the same happens with Chrome instead of Firefox?Rauwolfia
C
3

I encountered the same problem, the final solution is: re-install again geckodriver

  1. Unzip the geckodriver.zip
  2. Move the file to /usr/bin directory sudo mv geckodriver /usr/bin
  3. Goto /usr/bin directory cd /usr/bin,then you would need to run something like sudo chmod a+x geckodriver to mark it executable.
Christianechristiania answered 26/10, 2017 at 11:40 Comment(0)
W
3

this might not be your situation, but I got the same error message when running a test (same book, hehe) without having anything actually listening on the targeted port (8000, in my case). Make sure there's something listening for a request by manually opening your browser and going to localhost:8000. In my case - silly me - I didn't have the server up at all =)

Willywilly answered 7/6, 2018 at 23:39 Comment(0)
T
3

I also followed the same tutorial and came across the same error. I noticed that I am not running the django server. The following is what helped.

python manage.py runserver
python functional_test.py
Talkie answered 8/5, 2019 at 7:37 Comment(0)
M
1

I got this problem in this situation: the application put the computer name to the proxy host,so the proxy like this:

theComputerName:proxyPort

but the theComputerName:proxyPort can not be visit,so I put this into the host:

127.0.0.1 theComputerName

then restart the application,the problem resolved perfect

Minutes answered 2/11, 2022 at 2:59 Comment(0)
C
0

Being that this is a snapshot (around Django 1.8's time) of "Obey The Testing Goat" - perhaps the instructions there are no longer relevant. I suggest going straight to the goat's mouth and starting over!

The issue could be related to virtualenvwrapper (which is no longer necessary) or it could be related to the port/address that you were trying to access. Depending on your version of Selenium and Firefox there may be issues related to that as well.

Chatterjee answered 5/7, 2017 at 4:24 Comment(1)
btw obeythetestinggoat.com doesn't work for me, it needs www: obeythetestinggoat.comRauwolfia
W
0

It depends on the situation.

Based on mine, after I changed the target URL, I can get the browser to load the URL normally, which means the original URL is not available.

Another way to check:

import requests
html = request.get(url)

Print the HTML, if you get the 503, which means the website is reachable.

Woll answered 10/6, 2021 at 9:54 Comment(0)
C
0

Since this is probably a common search result for those working through Obey the Testing Goat, I wanted to share the solution that worked for me. I had written self.browser.get('http://localhost:8000') and needed to use http instead of https to resolve the error.

Cleary answered 26/3, 2022 at 1:5 Comment(0)
A
-1

I learning TDD tutorial too. My problem was that inputed uncorrect url
http://http://mysite insted of http://mysite

Ales answered 16/11, 2022 at 14:14 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Hettiehetty

© 2022 - 2024 — McMap. All rights reserved.