[Erp5-report] r21659 - /erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 17 17:47:43 CEST 2008


Author: vincent
Date: Tue Jun 17 17:47:40 2008
New Revision: 21659

URL: http://svn.erp5.org?rev=21659&view=rev
Log:
Add support for checkboxes.

Modified:
    erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py

Modified: erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py?rev=21659&r1=21658&r2=21659&view=diff
==============================================================================
--- erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py (original)
+++ erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py Tue Jun 17 17:47:40 2008
@@ -117,6 +117,15 @@
     self.selectMainForm()
     self.browser[name] = value
 
+  def checkCheckbox(self, name, index=0, state=True):
+    """
+      Check (or uncheck, according to "state" parameter value) a checkbox, given
+      by name. If there are multiple checkbox with the same name, you can
+      specify the one to check by its index.
+    """
+    self.selectMainForm()
+    self.browser.find_control(name).items[index].selected = state
+
   def fillSelectFieldByPredicate(self, name, predicate):
     """
       Allow to select item(s) of a <select>-type field by iterating on




More information about the Erp5-report mailing list