Пример #1
0
    def find(self, locator_dict):
        """
        Finds element on the web page using locator dictionary

        Args:
        locator_dict is the dictionary of the locator which contains key
        values like {"locator":"input[name='email']","by":"By.CSS_SELECTOR"}

        Return webelement
        """
        try:
            return self._driver.find_element(by=locator_dict[BY], value=locator_dict[LOCATOR])
        except NoSuchElementException as e:
            self.create_screenshot()
            raise CouldNotLocateElementException(selector=locator_dict[BY], locator=locator_dict[LOCATOR])
Пример #2
0
 def delete_project(self, project_name, debug=False):
     self.wait_until_modal_dismissed()
     project_rows = self.driver.find_elements_(
         by_css(".styled_table tbody tr"))
     for row in project_rows:
         if project_name == row.find_element_by_class_name(
                 'project-id-class ').text:
             row.find_element_by_class_name('delete_project').click()
             self.driver.find(by_css('a#confirm_delete')).click()
             return
     self.driver.create_screenshot(
         "debug-ft-project-not-found-after-attempt-to-delete")
     raise CouldNotLocateElementException(
         ['.styled_table tbody tr', 'project-id-class', 'delete_project'],
         'by_css')