Selecting An Unnamed Text Field In A Mechanize Form (python)
So i'm making a program to batch convert street addresses to gps co-ordinates using mechanize and python. this is my first time using mechanize. I can select the form ('form2') on
Solution 1:
form.find_control(id="search")
?
Solution 2:
FWIW I solved this by using the above answer by lazy1 except that I was trying to assign a value after using the find_control method. That didn't work of course because of assignment, I looked deeper into the method and found setattr() and that worked great for assigning a value to to the field.
will not work
br.form.find_control(id="field id here") = "new value here"
will work
br.form.find_control(id="field id here").__setattr__("value", "new value here")
Post a Comment for "Selecting An Unnamed Text Field In A Mechanize Form (python)"