0

I am try to get the seleniumbase geckodriver (firefox) to work and it seems to be telling my that my driver file is a directory

E   NotADirectoryError: [Errno 20] Not a directory: '/usr/local/lib/python3.8/dist-packages/seleniumbase/drivers/geckodriver'
====================================================== short test summary info =======================================================
ERROR seleniumtest2.py - NotADirectoryError: [Errno 20] Not a directory: '/usr/local/lib/python3.8/dist-packages/seleniumbase/drive...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================== 1 error in 0.19s ==========================================================

I tried giving it just the directory and it told me it needed the file.

How do I get the geckodriver to work in seleniumbase?

code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


driver = webdriver.Firefox('/usr/local/lib/python3.8/dist-packages/seleniumbase/drivers/geckodriver')
#driver = webdriver.Firefox('/usr/bin/geckodriver')
driver.get("https://www.python.org")
print(driver.title)
search_bar = driver.find_element_by_name("q")
search_bar.clear()
search_bar.send_keys("getting started with python")
search_bar.send_keys(Keys.RETURN)
print(driver.current_url)
driver.close()

installation method:

seleniumbase install geckodriver

and

apt install firefox-geckodriver

same error, both driver files.

update:

my two driver locations

root@Inspiron:# ls -l /usr/bin/geckodriver 
-rwxr-xr-x 1 root root 3476048 Jun  3 10:17 /usr/bin/geckodriver



root@Inspiron:# ls -l /usr/local/lib/python3.8/dist-packages/seleniumbase/drivers/geckodriver
-rwxr-xr-x 1 user user 7008696 Oct 12  2019 /usr/local/lib/python3.8/dist-packages/seleniumbase/drivers/geckodriver
Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
brad
  • 870
  • 2
  • 13
  • 38
  • You've tried put the `geckodriver` file outside `python3.8` lib? like `/usr/local/bin/geckodriver`. – frianH Jun 26 '20 at 07:10
  • @frianH Yes, I have 2 driver files installed from two different package managers and the second one is the commented line in the code. I can flip back and forth between the two and both produce the same error, just specific to the file location/path – brad Jun 26 '20 at 13:28

1 Answers1

1

Try to use your drive name as the path, worked for me

driver=webdriver.Firefox('C:/usr/local/lib/python3.8/distpackages/seleniumbase/drivers/geckodriver')

request
  • 450
  • 1
  • 4
  • 10
  • I indicated my 2 driver file locations in the post and I used both. – brad Jun 26 '20 at 13:26
  • @brad yes, but you didn't used the c:/ directory to call them. Selenium doesn't know where to search for the path – request Jun 26 '20 at 14:20
  • I'm using Linux. There is no c: i did use the full path both times. – brad Jun 26 '20 at 15:44
  • ahh now I understand, maybe look at [this](https://stackoverflow.com/questions/48213384/how-to-add-chromedriver-to-path-in-linux) – request Jun 26 '20 at 15:54
  • Adding executable_path= to driver = webdriver.Chrome(executable_path='/usr/bin/geckodriver'), got it to work. – brad Jun 26 '20 at 16:02