python mechanize new page -


i using python , mechanize login site. can login, once in need have mechanize select new form , submit again. need 3 or times page need. once logged in how od slect form on 2nd apge?

import mechanize import urlparse  br = mechanize.browser() br.open("https://test.com") print(br.title()) br.select_form(name="login") br['login_name'] = "test" br['pwd'] = "test" br.submit()  new_br = mechanize.browser() new_br.open("test2.com") new_br.select_form(name="frm_page2")  # error happens 

i following error.

formnotfounderror: no form matching name 'frm_page2' 

thanks help.

you can't use name=' ' when finding form because mechanize uses 'name' itself.

if want find name, need do:

br.select_form(attrs={'name': 'login'}) 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -