简体   繁体   中英

Python Mechanize Form submit

I am trying to log into a web-page where with member number (medlemsnummer) and postal code (postnummer) with mechanize.

br = Browser()
br.open('http://www.bokklubben.no/SamboWeb/medlem/minSide.do')

br.select_form(nr=1)

br.form['loggInn'] = '123456'
br.form['passord'] = '0202'

br.submit()

It seems that it's just loading and nothing is happening.

The form has a name, LoginForm . So you should select it like so:

br.select_form("LoginForm")

Also the name of the first form field is login not loggInn so you use

br.form['login'] = '123456'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM