I'm having troubles getting my selenium to work in python 3.x. At first everything was working as supposed to. When I tried to use it a couple of hours later it would not work anymore. I'm using the following code (from the repository):
import unittest
from selenium import webdriver
class GoogleTestCase(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.addCleanup(self.browser.quit)
def testPageTitle(self):
self.assertIn('Google', self.browser.title)
if __name__ == '__main__':
unittest.main(verbosity=2)
======================================================================
ERROR: testPageTitle (__main__.GoogleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 7, in setUp
self.browser = webdriver.Firefox()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 104, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver
----------------------------------------------------------------------
Ran 1 test in 30.168s
FAILED (errors=1)
I have tried it with the chromedriver as well, and it makes no difference.
The things I have tried so far:
- reinstall selenium
- move drivers to /usr/local/bin
- check /etc/hosts/ for 127.0.0.1. localhost
- using the same driver version as browser version (for chrome at least).
I wasn't able to find any possible solutions online, and none of these have worked for me. Does anyone know what I can do?
Thanks in advance.