I want to mechanize to check if the current value of selected dropdown = the default value, then mechanize will choose another value in the list instead. The html of the dropdown is as follow:
<td class="label">List</td>
<td>
<select name="list" id="list" onchange="list()">
<option>---</option>
<option value='1'>1</option>
<option value='2'>2</option>
---other options---
My code is:
if br.form["list"] == "---":
br.form["list"].value = "1"
r = br.form["list"]
print(r)
However list value still returns:
['---']
Any idea?
You need to specify the value as a list:
According to the
mechanize
- Forms documentation: