I misunderstood how to configure Selenium RC with Python?

I'm having problems with Selenium RC. When I try to run scripts in Python, I see the message "Unable to import webdriver name".

I probably have something very simple. Let me explain every step I took (it’s better to be too grainy than too vague ...):

  • Download and configure the Java Development Kit and install Paths. The command "Java -version" gives "1.6.0_26"

  • Download the standalone Selenium RC server.

  • Started the server

  • Downloaded and installed 32-bit version of Python 2.6

  • We downloaded Python bindings from http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip . From the zip file, I copied selenium.py to the Python27 \ Libs directory.

  • Created a script in the Selenium IDE. Exported for Python.

When I try to run the script from IDLE, I see the message "ImportError: cannot import the name webdriver". script I run

from selenium import webdriver 

I do not see a function definition named 'webdriver' in selenium.py. Is this the wrong file? I am completely confused.

Scripts that do not reference "import webdriver" work very well.

Googling is very useless, and most tutorials are either incomplete or suggest the Linux environment (I use Windows).

Is this a problem with Selenium 1 and Selenium 2? Do I need Selenium 2 bindings? Are they different from mine?

Any help is appreciated.

+4
source share
1 answer

WebDriver is part of Selenium 2. You install the Selenium 1 bindings and then try to start WebDriver. This will not work.

In addition, the WebDriver API eliminates the need for a Server component (WebDriver is different from Selenium-RC). To use WebDriver, all you need is Python bindings for Selenium 2.

The easiest way to install them is with pip or easy_install

 pip install selenium 

or

 easy_install selenium 
+5
source

All Articles