0

I am trying to use selenium with python3. I made a tiny script to simply open a firefox browser, which leads to google.ch afterwards.
Now my problem is that this works fine with python2, but if I try to run the script with python3, firefox browser opens, but it doesn't open google.ch.

I really want to do the whole thing with python3.. Anyone an idea what the problem could be?

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By



# Replace below path with the absolute path
# to chromedriver in your computer
driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')

driver.get("https://google.ch")
wait = WebDriverWait(driver, 600)sudo rm 

Note: I installed selenium with pip3

Error Traceback:

Traceback (most recent call last):
  File "/home/pi/python_projects/SitzwacheTool/read.py", line 11, in <module>
    driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
  File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: connection refused
MBT
  • 21,733
  • 19
  • 84
  • 102
Donut
  • 157
  • 1
  • 14

0 Answers0