Skip to content

Instantly share code, notes, and snippets.

@fnneves
Last active October 5, 2020 20:55
Show Gist options
  • Save fnneves/231b0adb14147d0e3833694e1f183f39 to your computer and use it in GitHub Desktop.
Save fnneves/231b0adb14147d0e3833694e1f183f39 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Tell Selenium where you installed the chromedriver!
chromedriver_path = 'C:/Users/User/Downloads/chromedriver_win32/chromedriver.exe'
webdriver = webdriver.Chrome(executable_path=chromedriver_path)
# Getting the website through the webdriver
webdriver.get('https://www.somewebsite.com/accounts/login/?source=auth_switcher')
username = webdriver.find_element_by_name('username') # Similar to how BS works
username.send_keys('your_username')
password = webdriver.find_element_by_name('password')
password.send_keys('your_password')
button_login = webdriver.find_element_by_css_selector('button')
button_login.click() # Sending a click command to login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment