3

I'm trying to get the Selenium Android client to run in my emulator:

  1. Install SDK
  2. Run emulator
  3. Install android-server-2.0rc1.apk in the emulator and devices
  4. Forward the port by adb forward tcp:8080 tcp:8080
  5. Install Python and set the selenium.py seript as this page says: http://seleniumhq.org/docs/appendix_installing_python_driver_client.html
  6. Run the web driver client in the emulator
  7. Run the command in Python from selenium import webdriver
  8. This gives me the following error message:

    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
    from selenium import webdriver
    ImportError?: cannot import name webdriver
    

2 Answers 2

5

You need to install the selenium bindings for Python. Try this:

sudo pip install selenium
1

Run python and do this:

import sys

sys.path

it will return sort of "list of folders/modules" you can import from.
To be able to import from selenium, you need to have it in this list,
it appears similar to this:

'.../lib/python2.6/site-packages/selenium-2.12.1-py2.6.egg',

If you don't have one, chances are you did not installed it properly, or it didn't make it to your pythonpath.

If you still sure that you did install it, try to add path to the selenium folder to the sys.path manually like this:

import sys

path_to_selenium = '/path/to/installed/selenium'
sys.path.append(path_to_selenium)

from selenium import webdriver

For more information read this, this and this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.