def get_events(self): """Get list of elements that displayed in Tree View on Event widget.""" selenium_utils.get_when_clickable(self._driver, self._locators.FIRST_TREE_VIEW_ITEM) self._browser.elements(class_name="event-owner")[0].element( class_name="person-name").wait_until(lambda e: "@" in e.text) return self._driver.find_elements(*self._locators.TREE_VIEW_ITEMS)
def choose_and_fill_dropdown_lca(self, dropdown_id, option_title, **kwargs): """Choose and fill comment or url for Assessment dropdown.""" self.select_ca_dropdown_option(dropdown_id, option_title) SetValueForAsmtDropdown(self._driver).fill_dropdown_lca(**kwargs) selenium_utils.get_when_clickable(self._driver, WidgetInfoAssessment.BUTTON_COMPLETE)
def choose_and_fill_dropdown_lca(self, dropdown_id, option_title, **kwargs): """Choose and fill comment or url for Assessment dropdown.""" self.select_ca_dropdown_option(dropdown_id, option_title) set_value_for_asmt_ca.SetValueForAsmtDropdown( self._driver).fill_dropdown_lca(**kwargs) selenium_utils.get_when_clickable( self._driver, WidgetInfoAssessment.BUTTON_COMPLETE)
def select_ca_dropdown_option(self, dropdown_id, option_value): """Select custom attribute dropdown option.""" dropdown_locator = ( By.CSS_SELECTOR, "#form-field-{}".format(dropdown_id)) selenium_utils.get_when_clickable( self.info_widget_elem, dropdown_locator) base.DropdownStatic(self.info_widget_elem, dropdown_locator).select(option_value)
def select_ca_dropdown_option(self, dropdown_id, option_value): """Select custom attribute dropdown option.""" dropdown_locator = (By.CSS_SELECTOR, "#form-field-{}".format(dropdown_id)) selenium_utils.get_when_clickable(self.info_widget_elem, dropdown_locator) base.DropdownStatic(self.info_widget_elem, dropdown_locator).select(option_value)
def open_add_new_ca_modal(self): """Open Add Attribute modal and return Custom Attribute Modal.""" selenium_utils.wait_until_stops_moving(self.button_add.element) selenium_utils.scroll_into_view(self._driver, self.button_add.element) selenium_utils.get_when_clickable(self._driver, self._locators.ADD_BTN) selenium_utils.get_when_invisible( self._driver, self._locators.TREE_SPINNER) self.button_add.click() return CustomAttributeModal(self._driver)
def open_add_new_ca_modal(self): """Open Add Attribute modal and return Custom Attribute Modal.""" selenium_utils.wait_until_stops_moving(self.add_btn.element) selenium_utils.scroll_into_view(self._driver, self.item_el) selenium_utils.get_when_clickable(self._driver, self._locators.ADD_BTN_CSS) selenium_utils.wait_until_not_present( self._driver, self._locators.TREE_SPINNER_CSS) self.add_btn.click() return CustomAttributeModal(self._driver)
def choose_and_fill_dropdown_lca(self, dropdown, **kwargs): """Choose and fill comment or url for Assessment dropdown.""" self.fill_ca_values({dropdown.title: dropdown.multi_choice_options}, is_global=False, is_inline=True) set_value_for_asmt_ca.SetValueForAsmtDropdown( self._driver).fill_dropdown_lca(**kwargs) selenium_utils.get_when_clickable( self._driver, locator.WidgetInfoAssessment.BUTTON_COMPLETE)
def open_add_new_ca_modal(self): """Open Add Attribute modal and return CustomAttributeModal PageObject.""" selenium_utils.wait_until_stops_moving(self.button_add.element) selenium_utils.scroll_into_view(self._driver, self.button_add.element) selenium_utils.get_when_clickable(self._driver, self._locator.ADD_BTN) selenium_utils.get_when_invisible(self._driver, self._locator.TREE_SPINNER) self.button_add.click() return CustomAttributeModal(self._driver)
def select_ca_member_by_num(self, num): """Select Custom Attribute member from list of members by number (start from 0). Args: num (int) Return: lib.page.widget.widget_base.CustomAttributeModal """ # check that the buttons are loaded selenium_utils.get_when_clickable(self._driver, self._locators.EDIT_BTN) elements = self._driver.find_elements(self._locators.EDIT_BTN) selenium_utils.scroll_into_view(self._driver, elements[num]).click() return CustomAttributeModal(self._driver)
def edit_nth_member(self, member): """Selects nth member from listed members in the dropdown. Since we're selecting from a list, the first member has the index 0. Args: member (int) """ # check that the buttons are loaded selenium_utils.get_when_clickable(self._driver, self._locator.EDIT_BTN) elements = self._driver.find_elements(self._locator.EDIT_BTN) selenium_utils.scroll_into_view(self._driver, elements[member]).click() return CustomAttributeModal(self._driver)
def _set_members_listed(self): """Waits for the listed members to be loaded and adds them to a local container""" self._set_member_count() if self.member_count: # wait until the elements are loaded selenium_utils.get_when_clickable( self._driver, locator.ObjectWidget.MEMBERS_TITLE_LIST) self.members_listed = self._driver.find_elements( *locator.ObjectWidget.MEMBERS_TITLE_LIST) else: self.members_listed = []
def select_member_by_num(self, num): """Select member from list of members by number (start from 0). Args: num (int) Return: lib.page.widget.info.Widget """ # pylint: disable=not-callable selenium_utils.wait_for_js_to_load(self._driver) self._set_members_listed() # need "try-except" block due to issue GGRC-1675 try: member = self.members_listed[num] # wait for the listed items animation to stop selenium_utils.wait_until_stops_moving(member) selenium_utils.click_via_js(self._driver, member) # wait for the info pane animation to stop info_panel = selenium_utils.get_when_clickable( self._driver, locator.ObjectWidget.INFO_PANE) selenium_utils.wait_until_stops_moving(info_panel) except exceptions.StaleElementReferenceException: self.members_listed = self._driver.find_elements( *locator.ObjectWidget.MEMBERS_TITLE_LIST) return self.select_member_by_num(num) except exceptions.TimeoutException: # sometimes the click to the listed member results in hover return self.select_member_by_num(num) return self.info_widget_cls(self._driver)
def select_member_by_num(self, num): """Select member from list of members by number (start from 0). Args: num (int) Return: lib.page.widget.info.Widget """ # pylint: disable=not-callable selenium_utils.wait_for_js_to_load(self._driver) self._set_members_listed() try: member = self.members_listed[num] # wait for the listed items animation to stop selenium_utils.wait_until_stops_moving(member) selenium_utils.click_via_js(self._driver, member) # wait for the info pane animation to stop info_panel = selenium_utils.get_when_clickable( self._driver, locator.ObjectWidget.INFO_PANE) selenium_utils.wait_until_stops_moving(info_panel) return self.info_widget_cls(self._driver) except exceptions.StaleElementReferenceException: self.members_listed = self._driver.find_elements( *locator.ObjectWidget.MEMBERS_TITLE_LIST) return self.select_member_by_num(num) except exceptions.TimeoutException: # sometimes the click to the listed member results in hover return self.select_member_by_num(num)
def select_nth_member(self, member): """Selects member from the list. Members start from (including) 0. Args: member (int) Returns: lib.page.widget.info.Widget """ try: element = self.members_listed[member] # wait for the listed items animation to stop selenium_utils.wait_until_stops_moving(element) element.click() # wait for the info pane animation to stop info_pane = selenium_utils.get_when_clickable( self._driver, locator.ObjectWidget.INFO_PANE) selenium_utils.wait_until_stops_moving(info_pane) return self._info_pane_cls(self._driver) except exceptions.StaleElementReferenceException: self.members_listed = self._driver.find_elements( *locator.ObjectWidget.MEMBERS_TITLE_LIST) return self.select_nth_member(member) except exceptions.TimeoutException: # sometimes the click to the listed member results in hover return self.select_nth_member(member)
def click(self): """When clicking on tab to first make sure it's clickable i.e. that this element will receive click.""" selenium_utils.get_when_clickable(self._driver, self._locator).click() self.is_activated = True
def get_element(self): return selenium_utils.get_when_clickable(self._driver, self._locator)
def get_element(self): """Get checkbox when web element clickable.""" return selenium_utils.get_when_clickable(self._driver, self._locator)
def get_events(self): """Get list of elements that displayed in Tree View on Event widget.""" selenium_utils.get_when_clickable(self._driver, self._locators.FIRST_TREE_VIEW_ITEM) return self._driver.find_elements(*self._locators.TREE_VIEW_ITEMS)
def get_events(self): """Get list of WebElements that displayed in tree view at Event widget""" selenium_utils.get_when_clickable(self._driver, self._locator.FIRST_TREE_VIEW_ITEM) return self._driver.find_elements(*self._locator.TREE_VIEW_ITEMS)
def get_events(self): """Get list of elements that displayed in Tree View on Event widget.""" selenium_utils.get_when_clickable( self._driver, self._locators.FIRST_TREE_VIEW_ITEM) return self._driver.find_elements(*self._locators.TREE_VIEW_ITEMS)
def click_create_button(self): """Click on the Create button on People widget""" add_button = selenium_utils.get_when_clickable( self._driver, self._locators.CREATE_PERSON_BUTTON_SELECTOR) add_button.click()
def get_events(self): """Get list of WebElements that displayed in tree view at Event widget""" selenium_utils.get_when_clickable( self._driver, self._locator.FIRST_TREE_VIEW_ITEM) return self._driver.find_elements(*self._locator.TREE_VIEW_ITEMS)