开发者

how to make python mechanize ignore dropdown constraints

I'm trying to use python mechanize to fill data into a webpage from an excel file.

b = Browser()
b.open("http://something/LoginForm.aspx")
b.select_form(nr=0)
b["ctl00$ContentPlaceHolder1$usertext"] = "username"
b["ctl00$ContentPlaceHolder1$passtext"] = "password"
b.submit()
b.select_form(nr=0)

The problem is that when a开发者_运维知识库 dropdown is changed, another dropdown menu changes. But I already know what to fill in the other dropdown before this. Can I force mechanize to fill it that way anyway?

With urllib i am not even able to login to this page...


This needs an example. In my experience with aspx pages is that it doesn't use ajax. The first control is probably submitting and causing the whole page to reload with the new values in the other dropdown.

There may also be VIEWSTATE variables that need to correspond with the form, which means it is probably impossible to build the entries in the form as you would like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜