I am trying to run this code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
username = ""
password = ""
driver = webdriver.Firefox()
driver.get("http://facebook.com")
assert "Facebook" in driver.title
elem = driver.find_element_by_id("email")
elem.send_keys(username)
elem = driver.find_element_by_id("pass")
elem.send_keys(password)
elem.send_keys(Keys.RETURN)
driver.close()
however i run into this error:
C:\Users\mali03\AppData\Local\Programs\Python\Python36\python.exe C:/Users/mali03/.PyCharmCE2018.1/config/scratches/exe.py Traceback (most recent call last): File "C:\Users\mali03\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.13.0-py3.6.egg\selenium\webdriver\common\service.py", line 76, in start stdin=PIPE) File "C:\Users\mali03\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in init restore_signals, start_new_session) File "C:\Users\mali03\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/mali03/.PyCharmCE2018.1/config/scratches/exe.py", line 5, in driver = webdriver.Firefox() File "C:\Users\mali03\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.13.0-py3.6.egg\selenium\webdriver\firefox\webdriver.py", line 160, in init self.service.start() File "C:\Users\mali03\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium-3.13.0-py3.6.egg\selenium\webdriver\common\service.py", line 83, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Process finished with exit code 1