How can I use mechanize to navigate through a table on a web-page if the table uses __doPostBack functions?
My code is:
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open("http://www.gfsc.gg/The-Commission/Pages/Regulated-Entities.aspx?auto_click=1")
page_num = 2
for link in br.links():
if link.text == str(page_num):
br.open(link) #I suspect this is not correct
break
for link in br.links():
print link.text, link.url
A search of all the controls in the table (e.g. drop-down menus) does not show the page buttons but a search for all the links in the table does. The page button does not contain a URL so it is not a typical link. I get TypeError: expected string or buffer.
I get the impression that this is something which can be done using mechanize.
Thanks for reading.