7
我想用python mechanize填充表單。形式如下:使用python機械化的複選框輸入
<POST https://10.20.254.39/cloud_computing/vmuser/migrate_vm/cli multipart/form-data
<TextControl(vm=cli)>
<TextControl(chost=10.20.14.39)>
<SelectControl(dhost=[*, 28, 27])>
<CheckboxControl(live=[on])>
<CheckboxControl(undefinesource=[on])>
<CheckboxControl(suspend=[on])>
<SubmitControl(<None>=Submit) (readonly)>
<HiddenControl(_formkey=85819e5a-02bb-42c8-891f-3ddac485438b) (readonly)>
<HiddenControl(_formname=migrate_create) (readonly)>>
我怎麼活的或undefinesource(複選框)的值設置爲True(打勾)或現場和undefinsource假(打鉤) 項目有:
>>> print br.form.controls[4].get_items()
[<Item name='on' id='migrate_undefinesource' checked='checked' name='undefinesource' type='checkbox' id='migrate_undefinesource' value='on' class='boolean'>]
>>> print br.form.controls[3].get_items()
[<Item name='on' id='migrate_live' checked='checked' name='live' type='checkbox' id='migrate_live' value='on' class='boolean'>]
該作品,謝謝:) :) –