Forums

selenium error

running this code give this errror geckodriver' executable needs to be in PATH.

from pyvirtualdisplay import Display
from selenium import webdriver

with Display():
# we can now start Firefox and it will run inside the virtual display
display = Display(visible=0, size=(800, 600))
display.start()
browser = webdriver.Firefox()

# put the rest of our selenium code in a try/finally
# to make sure we always clean up at the end
try:
    browser.get('http://www.google.com')
    #print browser.title #this should print "Google"

finally:
    browser.quit()

Are you using Python 3.6? I believe we may have the wrong Selenium version installed for that version (we're in the process of building a new system image which will fix that). If you are using Python 3.6, then the following bash command should fix the problem:

pip3.6 install --user selenium==2.53.6

If you're using a virtualenv, and have installed Selenium into it yourself, you'll need to run

pip install selenium==2.53.6