我正在尝试使用 Mechanize 在网页上的下拉菜单表单中选择一个选项。
到目前为止,我有以下内容:
import mechanize as mc
br = mc.Browser()
br.open(url='http://www.marseille-port.fr/fr/Page/Escale_consultation/13286')
效果很好。但后来我尝试使用以下方法查找页面上所有表单的名称:
for form in br.forms():
print "Form name:", form.name
print form
但我得到的只是看起来像一堆gobbledygook的东西。
如何从标题为“容器类型”的下拉菜单中选择“VRACS LIQUIDES”选项?无论如何我可以使用 br.forms() 方法来获得更好的效果吗?
提前致谢
编辑:
返回的 gobbledygook 如下:
Form name: RBS_FORM
<RBS_FORM POST http://www.marseille-port.fr/fr/Page/Escale_consultation/13286 application/x-www-form-urlencoded
<HiddenControl(radscriptmanager_TSM=) (readonly)>
<HiddenControl(__VIEWSTATE=/wEPDwULLTE4NTY1ODI0NTMPZBYCAgMPFgIeBGxhbmcFAmZyFgJmDxYCHgZhY3Rpb24FIi9mci9QYWdlL0VzY2FsZV9jb25zdWx0YXRpb24vMTMyODYWBAIDD2QWAmYPZBYEZg9kFgJmDxQrAAIUKwACDxYCHhdFbmFibGVBamF4U2tpblJlbmRlcmluZ2hkZGRkAgEPZBYCZg8UKwACFCsAAg8WAh8CaGQPFCsACRQrAAIPFgYeBFRleHQFB0FjY3VlaWweC05hdmlnYXRlVXJsBSBodHRwOi8vd3d3Lm1hcnNlaWxsZS1wb3J0LmZyL2ZyLx4GVGFyZ2V0ZWRkFCsAAg8WBh8DBRFCdWxsZXRpbiBPZmZpY2llbB8EBURodHRwOi8vd3d3Lm1hcnNlaWxsZS1wb3J0LmZyL2ZyL1BhZ2UvQnVsbGV0aW4lMjBPZmZpY2llbC8xMDAwMy9maXhlZB8FZWRkFCsAAg8WBh8DBQZFbXBsb2kfBAU3aHR0cDovL3d3dy5tYXJzZWlsbGUtcG9ydC5mci9mci9QYWdlL0VtcGxvaS8xMjk5OC9maXhlZB8FZWRkFCsAAg8WBh8DBQtDcm9pc2nDqHJlcx8EBUBodHRwOi8vd3d3Lm1hcnNlaWxs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EwM18wBRZPQkpfOTAwMDAxMjVfMCRyYWRtZW51BRZPQkpfNjAwMDAxMDVfMCRyYWRtZW51BRlPQkpfNjAwMDAxMTBfMCRyYWRzaXRlbWFw+UFoJy18wXduNOccW3Zrk3TB006mu83w6MD9bECvPoc=) (readonly)>
<HiddenControl(__EVENTVALIDATION=/wEWBQLTiIP0DALgyIDjDAKe1c2JCgK4oYOhDQL7yb/5BffLeOZ+lEq70djr/KIO9pPd70KCFfpxP7RAtn3CKcyZ) (readonly)>
<HiddenControl(OBJ_60000105_0_radmenu_ClientState=) (readonly)>
<HiddenControl(OBJ_90000125_0_radmenu_ClientState=) (readonly)>
<HiddenControl(OBJ_60000110_0_radsitemap_ClientState=) (readonly)>
<HiddenControl(OBJ_60000151_0=) (readonly)>
<HiddenControl(OBJ_60000151_0_SCROLLTOP=0) (readonly)>
<TextControl(OBJ_60000119_0=)>
<SubmitControl(OBJ_60000120_0=Rechercher) (readonly)>
<HiddenControl(PAGECONTROLE=635110847692788750,0) (readonly)>
<HiddenControl(EventObject=) (readonly)>
<HiddenControl(EventMethode=) (readonly)>
<HiddenControl(EventArgs=) (readonly)>>