Вот форма:
<p><label for="version_id">Version</label>
<select id="version_id" name="version_id"><option></option>
<option value="value1">2.1.1</option>
<option value="value2">2.1.2</option>
<option value="value3">2.1.3</option>
<option value="value4">2.1.4</option></select></p>
Мой код Python:
import mechanize
br = mechanize.Browser()
br.open('http://www.example.com/html/html_forms.asp')
br["version_id"] = ["value2"] # works
br["version_id"] = ["2.1.2"] # don't work
Сообщение об ошибке:
File "build/bdist.macosx-10.7-intel/egg/mechanize/_form.py", line 2782, in __setitem__
File "build/bdist.macosx-10.7-intel/egg/mechanize/_form.py", line 1977, in __setattr__
File "build/bdist.macosx-10.7-intel/egg/mechanize/_form.py", line 1998, in _set_value
File "build/bdist.macosx-10.7-intel/egg/mechanize/_form.py", line 2021, in _single_set_value
File "build/bdist.macosx-10.7-intel/egg/mechanize/_form.py", line 2006, in _get_items
mechanize._form.ItemNotFoundError: insufficient items with name '2.1.2'
Мой скрипт просто знает о "2.1.2 "var, как я могу установить выбранное значение, используя" 2.1.2 ", а не" value2 "?