Skip to content

Commit

Permalink
Make _findControl a regular method.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Jul 27, 2005
1 parent 3a2871b commit 4017c2c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions testbrowser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,17 @@ def click(self, text=None, url=None, id=None, name=None, coord=(1,1)):
url_regex=url_regex)
self._changed()

@property
def _findControl(self):
def _findControl(text, id, name, type=None, form=None):
for control_form, control in self._controls:
if form is None or control_form == form:
if (((id is not None and control.id == id)
or (name is not None and control.name == name)
or (text is not None and re.search(text, str(control.value)))
) and (type is None or control.type == type)):
self.mech_browser.form = control_form
return control_form, control

return None, None
return _findControl
def _findControl(self, text, id, name, type=None, form=None):
for control_form, control in self._controls:
if form is None or control_form == form:
if (((id is not None and control.id == id)
or (name is not None and control.name == name)
or (text is not None and re.search(text, str(control.value)))
) and (type is None or control.type == type)):
self.mech_browser.form = control_form
return control_form, control

return None, None

def _findForm(self, id, name, action):
for form in self.mech_browser.forms():
Expand Down

0 comments on commit 4017c2c

Please sign in to comment.