def bind_table_action(action_name):
 _actions_locator = (by.By.CSS_SELECTOR, 'div.table_actions > button, div.table_actions > a')
 def decorator(method):
  @functools.wraps(method)
  def wrapper(table):
   actions = table._get_elements(*_actions_locator)
   action_element = None
   for action in actions:
    target_action_id = ('%s__action_%s' % (table.name, action_name))
    if (action.get_attribute('id') == target_action_id):
     action_element = action
     break
   if (action_element is None):
    msg = ("Could not bind method '%s' to action control '%s'" % (method.__name__, action_name))
    raise ValueError(msg)
   return method(table, action_element)
  return wrapper
 return decorator

def bind_table_action ( action_name ) : _actions_locator = ( by . By . CSS_SELECTOR , 'div.table_actions > button, div.table_actions > a' ) def decorator ( method ) : @ functools . wraps ( method ) def wrapper ( table ) : actions = table . _get_elements ( * _actions_locator ) action_element = None for action in actions : target_action_id = ( '%s__action_%s' % ( table . name , action_name ) ) if ( action . get_attribute ( 'id' ) == target_action_id ) : action_element = action break if ( action_element is None ) : msg = ( "Could not bind method '%s' to action control '%s'" % ( method . __name__ , action_name ) ) raise ValueError ( msg ) return method ( table , action_element ) return wrapper return decorator
a decorator to bind table region method to an actual table action button .