Cannot run Firefox (geckodriver) properly from PyCharm python console

Viewed 1098

So i use PyCharm 2018.2.3, geckodriver 0.20, Firefox 63.0 and Python 3.6.5 in it for my Selenium auto-tests.

What I try to do in Python Console to run the driver:

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
wd = webdriver.Firefox(executable_path="C:\\Users\\user\\geckodriver.exe", firefox_profile=profile)

So the geckodriver runs in a new window. Then I ususally write

url = "https://website-address.com/"
wd.get(url)

But this time I get the message:

Previous command is still running. Please wait or press Ctrl+C in console to interrupt.

And then in like a couple of minutes geckodriver exit with these messages in log:

Traceback (most recent call last):
  File "<input>", line 4, in <module>
  File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
    keep_alive=True)
  File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: newSession

Please help me to understand what is going on and how to fix it.

2 Answers

I was having the same problem and was fixed after I update the geckodriver to v0.21.0

Related