im writing program goes school grades site , takes grades , makes them desktop background once grades cant how parse them out of large table
here code:
from bs4 import beautifulsoup selenium import webdriver selenium.webdriver.common.keys import keys driver = webdriver.chrome() driver.get("https://ps.rsd.edu/public/") elem = driver.find_element_by_name("account") elem.send_keys("username") elem2 = driver.find_element_by_name("pw") elem2.send_keys("password") elem.send_keys(keys.return) html = driver.page_source soup = beautifulsoup(html) print soup driver.quit() print "done"
this prints source page want grades out of row called s2 sorry kinda hard because cant show actual site
here names of rows in table:
<table class="grid"> <tr><th class="center" colspan="25">attendance class</th></tr> <tr class="center th2"> <th rowspan="2">exp</th> <th colspan="5">last week</th><th colspan="5">this week</th><th rowspan="2">course</th> <th rowspan="2">q1</th> <th rowspan="2">q2</th> <th rowspan="2">s1</th> <th rowspan="2">q3</th> <th rowspan="2">q4</th> <th rowspan="2">s2</th> <th rowspan="2">absences</th> <th rowspan="2">tardies</th> </tr>
and example row:
<a href="scores.html? frn=004711281&begdate=01/23/2013&enddate=06/07/2013&fg=s2">b<br>84</a></td> <td><a
this resource might you: locating elements in selenium
you might try using
find_element_by_link_text
and name of 1 of courses obtain element containing grades course
Comments
Post a Comment