Open ghost opened 12 years ago
No one? :(
.NET Postback basically uses only one big form with POST to drive the site.
You can try this one
import mechanize
import cookielib
br = mechanize.Browser(factory=mechanize.RobustFactory())
br.set_cookiejar(cookielib.LWPCookieJar())
br.set_handle_equiv = True
br.set_handle_redirect = True
br.set_handle_referer = True
br.set_handle_robots = False
br.open('http://AnotherStupidAspNet.com')
br.select_form(nr=0) # there is only one form, no need to hesitate
br.form['username'] = 'myusername'
br.form['password'] = 'mypassword'
br.form['button'] = 'AuthUC_btnLogin' # **important**, it may change base on what **LINK** you actually want to click
br.submit()
Hi.
We couldn't find a single example of using mechanize to submit .net forms. All examples we've seen so far uses pages or resources like
<a href="page.php.. <form action="/action/do"
and so on, but we need to log into a form that was made in .net. These are the controls if you view the source:
<a id="AuthUC_btnLogin" class="button primary login" href="javascript:__doPostBack('AuthUC$btnLogin','')">Login</a>
We just want to know if Mechanize can work with .net and, if possible, maybe a link with a few examples or documentation on how to implement it.
Thank you.
Leonardo.