Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium is giving " KeyError: 'sessionId' "

I am trying to start firefox using selenium but I am constantly getting

File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 150, in __init__
    keep_alive=True)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 180, in start_session
    self.session_id = response['sessionId']
KeyError: 'sessionId'

The code I am trying to run is fairly simple

from selenium import webdriver
driver = webdriver.Firefox()

Solutions I have tried:

  1. Tried updating selenium(I was already using the latest one)
  2. Updated the geckodriver to version 0.16.1
  3. Tried changing the proxy settings

Nothing has worked till now.

Configuration I am using: geckodriver 0.16.1 , Mozilla Firefox 53 , Python 2.7 , Selenium 3.4.1 , I am on a Mac system(if that helps)

like image 885
iVvaibhav Avatar asked May 01 '17 17:05

iVvaibhav


1 Answers

Upgrading from Selenium 3.2.0 to 3.7.0 fixed this error for me. I have geckodriver 0.19.1

pip install -U selenium
like image 196
xlash Avatar answered Oct 21 '22 02:10

xlash