Python (selenium): How To Login To A Website With A Login Redirect/organization Sign On
I am not a professional programmer, so please excuse any dumb mistakes--I am doing some research and I am trying to log into a database using Selenium to search it for about 1000 t
Solution 1:
Replace selenium
with browser
when you are finding an element and this will work.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
path_to_chromedriver = 'C:/Users/Kyle/Desktop/chromedriver'# change path as needed
browser = webdriver.Chrome(executable_path = path_to_chromedriver)
url = 'http://library.universityname.edu/corpaffils'
browser.get(url)
username = browser.find_element_by_id("login_id")
password = browser.find_element_by_id("login_password")
username.send_keys("my username")
password.send_keys("my password")
browser.find_element_by_name("submit").click()
You don't need to do anything for redirecting. It will redirect automatically once it logs in.
N.B: Don't forget to close
and quit
the browser when you are done.
Post a Comment for "Python (selenium): How To Login To A Website With A Login Redirect/organization Sign On"