Reputation: 9
When I try my code in the Atom IDE.
from selenium import webdriver
br = webdriver.Firefox()
br.get('https://www.facebook.com/login/')
email = br.find_element_by_id('email')
email.send_keys('7021038678')
pas = br.find_element_by_id('pass')
pas.send_keys('welcome')
pas.submit()
I get an error saying this:
selenium.common.exceptions.WebDriverException: Message: 'geckdriver.exe' executable needs to be in PATH.
I did pip install --user selenium in the console command in Atom. I've looked at other posts about this, however I'm not sure how I would fix it with the Atom IDE since I'm using Atom for Python instead of the Python IDE.
Upvotes: 0
Views: 2849
Reputation: 11
What you can do is:
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
It will try to install GeckoDriver for Firefox every time.
Note: First you have to install the package using:
pip install webdriver-manager
Upvotes: 1
Reputation: 9
You can also pass the path to Geckodriver during initializatin
br = webdriver.Firefox('@your_browser_path')
Upvotes: 1
Reputation: 713
I don't believe this is an issue with Selenium. You should read what the error says: 'geckdriver.exe' which is a FireFox webdriver selenium uses to run tests.
All you need to do is install geckodriver and make a reference to the file directory in your PATH in your systems environment variables
Upvotes: 0