Selenium error with ebdriver (geckodriver) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Selenium error with ebdriver (geckodriver) (/thread-21281.html) |
Selenium error with ebdriver (geckodriver) - Martinelli - Sep-22-2019 Hi, All! I am using this code: Quote:from selenium import webdriver But, I am getting the following error: Quote:/home/martinelli/PycharmProjects/ESAB/venv/bin/python /home/martinelli/PycharmProjects/ESAB/LogaSGE.py I have installed PYCharm Community 2019.2.2. It is Python 3.7. I am using Debian 10 (Buster). I have changed the permission from the / with rmx to all users, directories and files, in case, "geckodriver". Also, I have inserted "geckodriver" and its PATH on the enviromnent PATH, and, also, to the "Interpreter Paths". But it keeps giving this error. Has Anyone any ideia what I can do? RE: Selenium error with ebdriver (geckodriver) - metulburr - Sep-23-2019 Quote:I have changed the permission from the / with rmx to all users, directories and files, in case, "geckodriver". Also, I have inserted "geckodriver" and its PATH on the enviromnent PATH, and, also, to the "Interpreter Paths".You should not need to do any of that. The only odd thing might be PyCharm specific. just copy geckodriver to your /usr/local/bin example: metulburr@ubuntu:~$ cat test11.py from selenium import webdriver nav = webdriver.Firefox() metulburr@ubuntu:~$ python3 test11.py Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "/usr/local/lib/python3.6/subprocess.py", line 707, in __init__ restore_signals, start_new_session) File "/usr/local/lib/python3.6/subprocess.py", line 1326, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test11.py", line 2, in <module> nav = webdriver.Firefox() File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 144, in __init__ self.service.start() File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. metulburr@ubuntu:~$ mv /home/geckodriver /usr/local/bin mv: cannot move '/home/geckodriver' to '/usr/local/bin/geckodriver': Permission denied metulburr@ubuntu:~$ sudo !! sudo mv /home/geckodriver /usr/local/bin [sudo] password for metulburr: metulburr@ubuntu:~$ python3 test11.py metulburr@ubuntu:~$you could also just set the path directly driver = webdriver.Firefox(executable_path='your\path\geckodriver') RE: Selenium error with ebdriver (geckodriver) - Martinelli - Sep-23-2019 Thanks!!! I moved geckodriver to /usr/local/bin/, and, also, insert the line as you said. And I changed again, the permissions to 777 only for the file. nav = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')It worked! Thanks, again!!! RE: Selenium error with ebdriver (geckodriver) - metulburr - Sep-23-2019 (Sep-23-2019, 01:40 AM)Martinelli Wrote: I moved geckodriver to /usr/local/bin/, and, also, insert the line as you said.You dont need both. You would only need one or the other. You dont need the path at all if you put geckdriver in /usr/local/bin. Whereas if you did not, you can simply put the path as an argument RE: Selenium error with ebdriver (geckodriver) - Martinelli - Sep-24-2019 Ok! Thanks for that tip! Nice again! |