0
votes
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from bs4 import BeautifulSoup

my_username = "username"
my_password = "pass"

driver = webdriver.Firefox()
driver.get("http://www.twitch.tv/user/login")
elem_user = driver.find_element_by_id("login_user_login")
elem_passwd = driver.find_element_by_id("user[password]")
elem_user.send_keys(my_username)
elem_passwd.send_keys(my_password + Keys.RETURN)
time.sleep(5)

html = driver.page_source
soup = BeautifulSoup(html)
logginTag = soup.find("a", {"id" : "user_display_name"})
print(logginTag)
driver.close()

error- driver = webdriver.Firefox() File "/Users/grey/.pyenv/versions/3.7.3/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in init self.service.start() File "/Users/grey/.pyenv/versions/3.7.3/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start stdin=PIPE) File "/Users/grey/.pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 775, in init restore_signals, start_new_session) File "/Users/grey/.pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) NotADirectoryError: [Errno 20] Not a directory: 'geckodriver'

2

2 Answers

0
votes

When you are working with browser you need driver instance to interect , for example if you want to work chrome driver you need chrome driver exe and if you want open firefox you need gecko driver

https://github.com/mozilla/geckodriver/releases you can download latest driver from this link and setup path also and rerun project

0
votes

Baseed on

NotADirectoryError: [Errno 20] Not a directory: 'geckodriver'

suggest:

  • Make sure you have successfully installed Fixefox, to verify it by starting firefox in the console
  • Download geckodriver binary from https://github.com/mozilla/geckodriver/releases, note that geckodriver must match with Firefox version
  • Set the path. demo driver = webdriver.Firefox(executable_path=r'/User/xxx/geckodriver')