Skip to content

Commit

Permalink
Merge pull request #113 from lu-xianseng/master
Browse files Browse the repository at this point in the history
增加远程方法
  • Loading branch information
mikigo authored Sep 11, 2024
2 parents befcae5 + 019a073 commit 383bed4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/dogtail_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ def app_element(self, *args, **kwargs) -> Node:
except SearchError:
raise ElementNotFound(*args, **kwargs) from SearchError

def get_element_children_text(self, element):
element = self.app_element(element)
all_children = element.children
text = []
for i in range(len(all_children)):
text.append(all_children[i].name)
return text

def left_upper_corner_position(self, element) -> tuple:
"""
获取元素左上角的坐标
Expand Down Expand Up @@ -170,7 +178,7 @@ def __trace(self, element, result, expr):
else:
return False
try:
next_node = name[node.end() - 1 :]
next_node = name[node.end() - 1:]
if next_node != "/":
for i in element:
self.__trace(i, result, next_node)
Expand Down Expand Up @@ -238,4 +246,4 @@ def recur_inter(node=None):
recur_inter(i)

recur_inter()
return eles
return eles
8 changes: 7 additions & 1 deletion src/remotectl/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ def rdog(self) -> DogtailUtils:
)

def click_element_by_attr(self, element, button=1):
self.rdog.element_click(element, button=button)
self.rdog.element_click(element, button)

def get_element_children_txt(self, element):
return self.rdog.get_element_children_text(element)

def get_element_center(self, element):
return self.rdog.element_center(element)

@property
def rctl(self) -> Src:
Expand Down

0 comments on commit 383bed4

Please sign in to comment.