I am trying to automate the downloads of specific files for my organization. In doing so I came across Browser Automation with Selenium. I got to the point where I can inject user credentials, but now I need to login to the page by clicking on the login button.
Here is the parent URL, in which I inject my credentials https://www.accuplacer.org
Then I need to click on the login button. Here is the inspect output of that element:
<button type="submit" class="btn btn-lg btn-primary pull-left " ng-disabled="loginDisable && isFullyLoaded">
<!-- ngIf: loginSpin && !traceIE -->
<!-- ngIf: loginSpin && traceIE -->
Login
</button>
Here is the code I have so far, I know it's basic, and I am working on cleaning it up and defining somethings into functions.
import selenium
import os
import unittest
import requests
import time
from selenium import webdriver
#URL Variables
login_url = 'https://www.accuplacer.org/'
redirect_url = 'https://www.accuplacer.org/api/home.html#/'
reports_scheduler_url = 'https://www.accuplacer.org/api/home.html#/reportScheduler'
custom_reports_url = 'https://www.accuplacer.org/api/home.html#/customReports'
#WebDriver Path
browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\chromedriver.exe")
browser.get("https://www.accuplacer.org")
username = browser.find_element_by_id("login")
password = browser.find_element_by_id("password")
#submit = browser.find_element_by_id("Login")
username.send_keys("uname")
password.send_keys("test")
#browser.send_keys(Keys.ENTER)
#browser.send_keys(Keys.RETURN)
#submit.click()
browser.find_element_by_css_selector('btn btn-log btn-primary pull-left').click()