Teshan N.
Teshan N.

Reputation: 2545

Splinter: DriverNotFoundError for zope.testbrowser

I am using Python Splinter to automate a website and to scrape data from it. When I use the default browser mode which is keeping blank in Browser() it opens firefox and completes the written task but, when I use the headless browser 'zope.testbrowser', I get the following error. What should I need to do here?

Traceback (most recent call last):
  File "pysplinter.py", line 4, in <module>
    browser = Browser('zope.testbrowser')
  File "/usr/local/lib/python2.7/dist-packages/splinter/browser.py", line 62, in Browser
    raise DriverNotFoundError("No driver for %s" % driver_name)
splinter.exceptions.DriverNotFoundError: No driver for zope.testbrowser

Upvotes: 4

Views: 1280

Answers (1)

Pukeko
Pukeko

Reputation: 103

I don't know if this is still relevant, but will post anyway for the benefit of others.

I faced the same issue and my problem was that mechanize module was not installed.

Fix:

pip install mechanize

However, I faced another issue after this.

Explanation

That's the line of code that is failing in browser.py of splinter, but due to except: pass, it is being silently ignored. If executed manually, the root of the problem can be observed:

>>> from splinter.driver.zopetestbrowser import ZopeTestBrowser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rustam/.virtualenvs/python2/lib/python2.7/site-packages/splinter/driver/zopetestbrowser.py", line 19, in <module>
    import mechanize
ImportError: No module named mechanize

Upvotes: 3

Related Questions