예제 #1
0
 def expand_database_node(self, server_name, server_password,
                          name_of_database):
     """will expand database node under databases node"""
     db_node_expanded_status = False
     if self.expand_databases_node(server_name, server_password):
         sub_nodes_of_databases_node = self.find_by_xpath_list(
             TreeAreaLocators.sub_nodes_of_databases_node(server_name))
         index_of_required_db_node = self.get_index_of_element(
             sub_nodes_of_databases_node, name_of_database)
         expansion_status = self.get_expansion_status_of_node_element(
             self.find_by_xpath_list(
                 TreeAreaLocators.sub_nodes_of_databases_node_exp_status(
                     server_name))[index_of_required_db_node])
         if not expansion_status:
             self.driver.execute_script(
                 "arguments[0].scrollIntoView()",
                 sub_nodes_of_databases_node[index_of_required_db_node])
             webdriver.ActionChains(self.driver).double_click(
                 sub_nodes_of_databases_node[index_of_required_db_node]
             ).perform()
             if self.wait_for_elements_to_appear(
                     self.driver,
                     TreeAreaLocators.sub_nodes_of_database_node(
                         name_of_database)):
                 db_node_expanded_status = True
         else:
             db_node_expanded_status = True
     else:
         print("The databases/previous nodes not expanded", file=sys.stderr)
     return db_node_expanded_status
예제 #2
0
 def expand_database_node(self, server_name, server_password,
                          name_of_database):
     """will expand database node under databases node"""
     db_node_expanded_status = False
     retry = 5
     if self.expand_databases_node(server_name, server_password):
         sub_nodes_of_databases_node = self.find_by_xpath_list(
             TreeAreaLocators.sub_nodes_of_databases_node(server_name))
         index_of_required_db_node = self.get_index_of_element(
             sub_nodes_of_databases_node, name_of_database)
         expansion_status = self.get_expansion_status_of_node_element(
             self.find_by_xpath_list(
                 TreeAreaLocators.sub_nodes_of_databases_node_exp_status(
                     server_name))[index_of_required_db_node])
         if not expansion_status:
             self.driver.execute_script(
                 "arguments[0].scrollIntoView()",
                 sub_nodes_of_databases_node[index_of_required_db_node])
             while retry > 0:
                 webdriver.ActionChains(self.driver).double_click(
                     sub_nodes_of_databases_node[index_of_required_db_node]
                 ).perform()
                 if self.check_if_element_exist_by_xpath(
                         "//div[@class='ajs-header'and text()='INTERNAL SERVER "
                         "ERROR']", 1):
                     try:
                         self.click_modal('OK')
                     except Exception:
                         pass
                     retry -= 1
                 else:
                     break
             if self.wait_for_elements_to_appear(
                     self.driver,
                     TreeAreaLocators.sub_nodes_of_database_node(
                         name_of_database)):
                 db_node_expanded_status = True
         else:
             db_node_expanded_status = True
     else:
         print("The databases/previous nodes not expanded", file=sys.stderr)
     return db_node_expanded_status