def __init__(self, driver, locator_or_element, item_btn_locator=None): super(TreeViewItem, self).__init__(driver, locator_or_element) self.item_btn = (None if item_btn_locator is None else selenium_utils.get_element_safe( self.element, item_btn_locator)) if self.item_btn: self.js_field_name = "instance" else: self.js_field_name = "itemData"
def item_type(self): """Item type defined by class of icon""" if not self._item_type: icon = selenium_utils.get_element_safe( self.element, self._locators.DROPDOWN_ITEM_ICON_CSS) if icon: icon_type = icon.get_attribute("class") self._item_type = next( (v for k, v in self._elements.__dict__.iteritems() if not k.startswith("_") and v in icon_type), icon_type) return self._item_type
def __init__(self, driver, locator_or_element, item_btn_locator=None): super(TreeViewItem, self).__init__(driver, locator_or_element) self.item_btn = ( None if item_btn_locator is None else selenium_utils.get_element_safe( self.element, item_btn_locator))