How do you select choices in a form using Python?

后端 未结 2 1884
梦谈多话
梦谈多话 2021-02-02 02:20

I\'d like to know how to select options in a form that is formatted like

  
                  )?

The Mechanize docs for python sketch out how to select list items. Here's the sample they provide:

# Controls that represent lists (checkbox, select and radio lists) are
# ListControl instances.  Their values are sequences of list item names.
# They come in two flavours: single- and multiple-selection:
form["favorite_cheese"] = ["brie"]  # single

In your case, the code to select Value1 would look like this:

form["FORM1"] = ["Value1"]

提交回复
热议问题