def set_checkbox(view, name, fill): """Fill or clear a checkbox next to a credential.""" checkbox = Checkbox(view, locator=Locator(xpath=checkbox_xpath(name))) try: checkbox.fill(fill) except WidgetOperationFailed: clear_toasts(view=view) checkbox.fill(fill)
def _cb_action(self, filter_name, action, value=None): self.open() try: _cb = Checkbox(locator=self.ITEM.format(filter_name), parent=self) if action is 'fill': _cb.fill(value) elif action is 'read': return _cb.read() finally: self.close()