Skip to content

Commit b3e183b

Browse files
author
Towshik
committed
Checked if the current AutomationElement is based on the desired application using process id inside function -get_main_window as the change was requested by Muhib vai, tested the change as well
1 parent eb55086 commit b3e183b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Framework/Built_In_Automation/Desktop/Windows/BuiltInFunctions.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,9 @@ def Element_only_search(
403403

404404
)
405405
all_elements += tmp_elements
406-
new_all_elements = []
407-
for i in all_elements:
408-
if i.Current.ProcessId in current_pid_list:
409-
new_all_elements.append(i)
410406

411-
if new_all_elements:
412-
return new_all_elements
407+
if all_elements:
408+
return all_elements
413409
else:
414410
return "zeuz_failed"
415411

@@ -1244,7 +1240,13 @@ def _get_main_window(WindowName):
12441240
MainWindowsList = AutomationElement.RootElement.FindAll(
12451241
TreeScope.Children, Condition.TrueCondition
12461242
)
1247-
for MainWindowElement in MainWindowsList:
1243+
1244+
NewMainWindowsList = []
1245+
for i in MainWindowsList:
1246+
if i.Current.ProcessId in current_pid_list:
1247+
NewMainWindowsList.append(i)
1248+
1249+
for MainWindowElement in NewMainWindowsList:
12481250
try:
12491251
if WindowName[2] == "pid":
12501252
try:

0 commit comments

Comments
 (0)