You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Workaround for people who stumble over this bug. Execute at the beginning of your code:
import mechanize
from mechanize import _request
from mechanize._form import ControlNotFoundError
def _click(self, name, type, id, label, nr, coord, return_type,
request_class=_request.Request):
try:
control = self._find_control(
name, type, "clickable", id, label, None, nr)
except ControlNotFoundError:
if ((name is not None) or (type is not None) or (id is not None) or
(nr != 0) or (label is not None)): # fixed by cvogt, see http://github.com/jjlee/mechanize/issues/16
raise
# no clickable controls, but no control was explicitly requested,
# so return state without clicking any control
return self._switch_click(return_type, request_class)
else:
return control._click(self, coord, return_type, request_class)
mechanize._form.HTMLForm._click = _click
No control with label 'asdfasdfasdf' exists. Mechanize still submits the form.
The following seems to fix the issueVersion 0.2.0. In _form.py, line 3190 add to the condition:
With this fix the above clock() call raises
ControlNotFoundError: no control matching kind 'clickable', label 'asdfasdfasdf'
The text was updated successfully, but these errors were encountered: