开发者

How to select a Radio Button?

开发者 https://www.devze.com 2023-01-17 11:19 出处:网络
I am using mechanize and I am trying to select a button from a radio button list. This list has 5 items. How can I select the first item? Docs didn\'t help me.

I am using mechanize and I am trying to select a button from a radio button list. This list has 5 items. How can I select the first item? Docs didn't help me.

>>> br.form
<ClientForm.HTMLForm instance at 0x9ac0d4c>
>>> print(br.form)
<form1 POST http://www.example.com application/x-www-form-urlencoded
<HiddenControl(DD=17010200) (readonly)>
<RadioControl(prodclass=[1, 2, 3, 4, 5])>
<SubmitControl开发者_运维百科(submit=text) (readonly)>>


It should be as simple as

br.form['prodclass'] = ['1']

I prefer the more verbose:

br.form.set_value(['1'],name='prodclass')
0

精彩评论

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