I've been using Selenium with Python 3 for a while. Yesterday it stopped working. I've tried uninstalling and reinstalling everything, but it hasn't worked. I enabled the driver for Safari, and that works, but I don't know what changed. I tried going to a different project that I haven't used in a while but functioned, thinking my code threw it off, but it doesn't work either. I know there are other posts out there similar to this, but they haven't been helpful and I wasn't sure if I should contact Mozilla/Selenium about this issue. Here are my details:
Python 3.7.1
Django 2.1
Firefox 64
Selenium 3.141.0
Geckodriver 0.23.0
I am running these in a virtual environment. Any more questions, let me know. Really confused as to what broke.
This is all of the code related to launching the browser:
class FunctionalTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def get_page(self, url_extention, window=None):
window_size = [900, 700]
if window == 'xs':
window_size = [500, 700]
elif window == 'sm':
window_size = [700, 500]
elif window == 'md':
window_size = [900, 700]
elif window == 'lg':
window_size = [1024, 768]
elif window == 'xl':
window_size = [1400, 800]
return (
self.browser.get(
self.live_server_url + url_extention
),
self.browser.set_window_size(
window_size[0],
window_size[1]
)
)
class PageFunctionTest(FunctionalTest):
def test_customer_page(self):
self.get_page('/customer/profile/1/', window='xs')
# I also tried this just to check:
self.browser.get(self.live_server_url)
Basically the browser opens, throws an error and then quits. This is what shows in the browser window:
address bar: http//localhost:59905/customer/profile/1/
browser error: Firefox can’t establish a connection to the server at localhost:59905.
And this is the traceback:
Traceback (most recent call last): File "tests/functional_tests/test_function_profile_update_phone_number.py", line 21, in test_update_profile_phone_number self.get_page(f'/customer/profile/1/', window='xs') File "/base_tests/base_FunctionalTest.py", line 70, in get_page self.live_server_url + url_extention File "/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get self.execute(Command.GET, {'url': url}) File "/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, 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%3A59905/customer/profile/1/&c=UTF-8&f=regular&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20localhost%3A59905.