def find_child_node(self, content, child_name, top, padding): child_nodes = self.find_them(UI.get_tree_nodes_locator(), parent=content) for child_node in child_nodes: child_parent = self.get_parent_node(child_node) child_parent_top = self.get_element_top(child_parent) if lt_pixels(child_parent_top, top): continue child_padding = self.get_element_padding_left(child_node) if lt_pixels(child_padding, padding): continue child_node_content = self.find_it(UI.get_tree_node_content_locator(), parent=child_node) if child_node_content.text != child_name: continue if child_node_content.text == child_name: return child_node child_node_padding_left = self.get_element_padding_left(child_node) # we reached another Connection name, but looking not for a connection if child_node_padding_left == "0px" and padding != "0px": print("Next connection reached!") print("child_node_padding_left: '{0}'".format(child_node_padding_left)) print("padding: '{0}'".format(padding)) break return None
def click_node_to_expand(self, node): parent_node = self.get_parent_node(node) child_node_content = self.find_it(UI.get_tree_node_content_locator(), parent=node) node_id = child_node_content.get_attribute(constants.TYPE_ID) if constants.THEIA_TREE_EXPANDABLE_NODES in node.get_attribute(constants.TYPE_CLASS): arrow = self.find_it(UI.get_theia_expand_arrow_locator(), parent=parent_node) is_expanded = self.is_element_expanded(arrow) if not is_expanded: highlight(node) self.click_me(node) return node_id
def find_host(self, content, connection_name, expandable=True, padding_left="0px"): tree_nodes = self.wait_for_nodes(content, expandable) for tree_node in tree_nodes: highlight(tree_node) node_padding_left = self.get_element_padding_left(tree_node) if node_padding_left != padding_left: continue node_content = self.find_it(UI.get_tree_node_content_locator(), parent=tree_node) if node_content.text == connection_name: return tree_node return None