selinium

Hi,

Selenium does not always seem to work, sometimes it does, sometimes it doesn't. Any advise what is happening, thanks in advance.

I have the following program:
   from selenium import webdriver
   browser = webdriver.Firefox()
   browser.get('https://python.org')

When I run using "run" in  Pycharm 3.1.2 I get (taken out some of the lines for clarity):

  E:\python_virtual_envs\py34_ve1\Scripts\python.exe E:/djangoprojects_hp_17/scrape/selenium.py
  Traceback (most recent call last):
      from selenium import webdriver
  ImportError: cannot import name 'webdriver'


When I run the same code in a "run Python console" it works (for completeness the console):

  E:\python_virtual_envs\py34_ve1\Scripts\python.exe -u C:\Program Files (x86)\JetBrains\PyCharm
            3.0.2\helpers\pydev\pydevconsole.py 50622 50623
  PyDev console: starting.
  import sys; print('Python %s on %s' % (sys.version, sys.platform))
  Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit (Intel)] on win32
  sys.path.extend(['E:\\djangoprojects_hp_17\\scrpae'])
  >>> from selenium import webdriver
  browser = webdriver.Firefox()
  browser.get('https://python.org')

  >>>


Kind regards,
Maarten Zaanen

Please sign in to leave a comment.