Selecting an unnamed text field in a mechanize form (python)

倖福魔咒の 提交于 2019-12-01 08:07:22

form.find_control(id="search") ?

FWIW I solved this by using the above answer by lazy1 except that I was trying to assign a value after using the find_control method. That didn't work of course because of assignment, I looked deeper into the method and found setattr() and that worked great for assigning a value to to the field.

will not work

br.form.find_control(id="field id here") = "new value here"

will work

br.form.find_control(id="field id here").__setattr__("value", "new value here")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!