So I'm writing a Python script that checks Blackboard (school interface site) for updates. But the HTML I receive back from my script is not completely the same as the HTML when viewed in my browser. I'm unsure if this is a cookie issue or what I'm missing.
USERNAME = ''
PASSWORD = ''
updates = 0
site = 'http://schoolsite.edu'
browser = mechanize.Browser()
browser.open(site)
browser.select_form(nr = 0)
browser.form['j_username'] = USERNAME
browser.form['j_password'] = PASSWORD
browser.submit()
#it brings back an empty form, just submit it.
browser.select_form(nr = 0)
browser.submit()
html_resp = browser.response().read()
The HTML in question looks like this (this is from the script)
<span id="badgeTotal" style="visibility: hidden" title="">
<span class="hideoff" id="badgeAXLabel">Activity Updates</span>
<span class="badge" id="badgeTotalCount" title=""></span>
What I was expecting it to look like (from Chrome/actual browser)
<span id="badgeTotal" style="visibility: visible;" title="">
<span class="hideoff" id="badgeAXLabel">Activity Updates</span>
<span class="badge" id="badgeTotalCount" title="">1</span>
What I'm really after is that '1' number in the last line, but I feel like the visibility attribute is holding it back. Note that I get the same cookies from Mechanize that I also get in browser. (not exact same, but same id, name, ect.)
Any thoughts?
Any input is appreciated.