i am creating a python application that goes to my profile on a website and gives me the text on that page. however, i need to log in first, while i can fill in the login information, i cannot actually submit that. once i found out how to use browser.launch_browser() to show me what was happening, i saw that the log in button was greyed out and unable to be clicked. after playing around with the log in page on a real browser, i found out that the button stays disabled until you type a character into the username field.
from bs4 import BeautifulSoup as bs
import mechanicalsoup
import time
headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Max-Age': '3600',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'
}
browser = mechanicalsoup.StatefulBrowser(user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0')
username = "username"
password = "Pass123"
url = 'https://myschool.compass.education'
loginpage = browser.open(url)
loginhtml = loginpage.soup
time.sleep(0.5)
browser.select_form()
time.sleep(0.5)
browser["username"] = username
time.sleep(0.5)
browser["password"] = password
time.sleep(0.5)
home = browser.submit_selected()
im using mechanicalsoup here, but if any of you know of a different module that i can use to fix this problem, feel free to tell me.