Why doesn't Selenium's response have a sessionId?

0
0

I’m trying to run Selenium’s Firefox webdriver and am getting the error below. I can see that the response does not have a sessionId – the offending line is self.session_id = response['sessionId'] – but I don’t know why. I’ve run this in the following ways and get the same error:

  1. Cygwin, running nosetests
  2. Cygwin directly
  3. Windows, running nosetests
  4. Windows directly


----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\dev\tools\cygwin\home\207013288\dev\projects\scorpion\test\unit\test_
approve_workflows.py", line 27, in test_login
'password', userid='207013288', test=True)
File "C:\dev\tools\cygwin\home\207013288\dev\projects\scorpion\src\workflows.p
y", line 20, in login
browser = webdriver.Firefox()
File "C:\dev\sdks\Python33\lib\site-packages\selenium-2.32.0-py3.3.egg\seleniu
m\webdriver\firefox\webdriver.py", line 62, in __init__
desired_capabilities=capabilities)
File "C:\dev\sdks\Python33\lib\site-packages\selenium-2.32.0-py3.3.egg\seleniu
m\webdriver\remote\webdriver.py", line 72, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\dev\sdks\Python33\lib\site-packages\selenium-2.32.0-py3.3.egg\seleniu
m\webdriver\remote\webdriver.py", line 116, in start_session
self.session_id = response['sessionId']
nose.proxy.KeyError: 'sessionId'
-------------------- >> begin captured logging << --------------------
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:63801/
hub/session {"sessionId": null, "desiredCapabilities": {"version": "", "browserN
ame": "firefox", "platform": "ANY", "javascriptEnabled": true}}
--------------------- >> end captured logging << ---------------------

I haven’t used Selenium before and I’m not sure where to go from here.

  • You must to post comments
0
0

OK, first of all I’d like to say that I nearly pulled out all my hair trying to fix this.
My setup:
Python 2.7
Firefox 22.0
Selenium WebDriver 2.33
Windows XP (internet connection via proxy server)

Spotted my problem yet?

Solution:

  • Open the control Panel
  • Internet options
  • Connections
  • LAN Configuration
  • On this page you will probably see the details of your proxy server, complete with a checkbox: “Do not use proxy server for local addresses”.
    This checkbox is probably already selected (as it makes good sense to not use a proxy for local addresses).
    Unfortunately, Selenium WebDriver appears to ignore this checkbox and it’s value.
    Checked or unchecked, it will detect your proxy server and apply it to all url’s (or at least that’s what it did in my case.)
  • Click the “Advanced” button, and manually enter “127.0.0.1” in the “Exceptions” box.
  • Save the change.
  • Re-run your test in web driver, hopefully you will no longer see error message that refers to: self.session_id = response[‘sessionId’]

Things that didn’t work for me:

Before finding this solution (with the aid of a more experienced engineer) I went through the instructions here:http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#advanceduserinteractions
.. for setting/changing/bypassing the proxy. Didn’t get me the result I was looking for, though.

I also looked at this:
Implementing WebdriverBackedSelenium in Python
.. but it speaks of a older version of webdriver, and it suggests removing all the proxy settings system wide, which is an absolute non-starter (as far as I’m concerned).

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website