Reputation: 878
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
Upvotes: 1
Views: 420
Reputation: 510
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')
Upvotes: 1