def wait_for_tab_exist(self, tab_text): main_content = self.find_it(UI.get_theia_main_content_panel_locator()) tab_container = self.find_it(UI.get_tab_content_locator(), parent=main_content) tabs = self.find_them(UI.get_tabs_locator(), parent=tab_container) for tab in tabs: if tab.text == tab_text: return tab raise WebDriverException
def get_active_tab_element(self): # <li> id like "^shell-tab-code-editor-opener:.*$" main_content = self.find_it(UI.get_theia_main_content_panel_locator()) tab_container = self.find_it(UI.get_tab_content_locator(), parent=main_content) tabs = self.find_them(UI.get_tabs_locator(), parent=tab_container) for tab in tabs: if constants.THEIA_CURRENT_TAB in tab.get_attribute( constants.TYPE_CLASS): return tab return None
def invoke_left_bar_item(self, item): WebDriverWait(self._driver, self.DEFAULT_TIMEOUT).until( expected_conditions.presence_of_element_located(UI.get_left_menu_bar_locator()) ) WebDriverWait(self._driver, self.DEFAULT_TIMEOUT).until( expected_conditions.presence_of_all_elements_located(UI.get_tabs_locator()) ) theia_left_panel = self.find_it(UI.get_theia_left_panel_locator()) menu_content = self.find_it(UI.get_left_menu_bar_locator(), theia_left_panel) menu_elements = self.find_them(UI.get_tabs_locator(), menu_content) menu_item = None for menu_element in menu_elements: title = menu_element.get_attribute(constants.ELEMENT_TITLE) if title == item: menu_item = menu_element break if menu_item is None: raise WebDriverException self.click_me(menu_item, item)