Search code examples
pythonweb-applicationsselenium-firefoxdriversplinter

How to set up a custom webdriver for splinter in python?


I have read the api doc on how to setup the the chrome webdriver but I am a little new to **kwargs and I have to pass the executable_path as a dictionary entry, can some one tell me what am I doing wrong in my code?

executable_path = {'executable_path':'/usr/bing/firefox-esr'}
browser = Browser('firefox', **executable_path)

this is the error im getting

Traceback (most recent call last):
  File "logger.py", line 10, in <module>
    browser = Browser('firefox', **executable_path)
  File "/usr/local/lib/python2.7/dist-packages/splinter/browser.py", line 63, in Browser
    return driver(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'executable_path'

and this is the code that is supplied by the splinter website as an example

executable_path = {'executable_path':'</path/to/chrome>'}
browser = Browser('chrome', **executable_path)

Solution

  • Nvm guys, the problem was I didn't have a geckodriver in usr/local/bin folder and then you can set browser = Browser ('firefox')