diff --git a/.gitignore b/.gitignore index 9f631c3d..0573fc7f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,11 @@ /**/__pycache__/** #Игнорируем папки распакованного блокнота Resources/Editor/Notepad++_7_7_x64/* -/Orchestrator/Reports \ No newline at end of file +/Orchestrator/Reports +/Robot/Reports +/Studio/Reports +/**/OpenRPAOrchestrator.exe +/**/OpenRPAStudio.exe +/**/OpenRPARobot.exe +/**/breakpoints.lst +/Orchestrator/screenshot.png \ No newline at end of file diff --git a/Robot/GUI.py b/Robot/GUI.py index 191971ac..9ecb44d5 100644 --- a/Robot/GUI.py +++ b/Robot/GUI.py @@ -97,8 +97,10 @@ mDefaultPywinautoBackend="win32" #] ################ #return: List of UI Object +#inElement - Входной элемент - показатель, что не требуется выполнять коннект к процессу +#inFlagRaiseException - Флаг True - выкинуть ошибку в случае обнаружении пустого списка #old name - PywinautoExtElementsGet -def UIOSelector_Get_UIOList (inSpecificationList,inElement=None): +def UIOSelector_Get_UIOList (inSpecificationList,inElement=None,inFlagRaiseException=True): lResultList=[] lChildrenList=[] #Получить родительский объект если на вход ничего не поступило @@ -148,7 +150,7 @@ def UIOSelector_Get_UIOList (inSpecificationList,inElement=None): lChildrenItemNewSpecificationList[0]["depth_start"]=lChildrenItemNewSpecificationList[0]["depth_start"]-1 #pdb.set_trace() #Циклический вызов для всех детей со скорректированной спецификацией - lResultList.extend(UIOSelector_Get_UIOList(lChildrenItemNewSpecificationList,lChildrenItem)) + lResultList.extend(UIOSelector_Get_UIOList(lChildrenItemNewSpecificationList,lChildrenItem,inFlagRaiseException)) #Фильтрация if lFlagGoCheck: lFlagAddChild=True @@ -177,28 +179,93 @@ def UIOSelector_Get_UIOList (inSpecificationList,inElement=None): if lFlagAddChild: lChildrenList.append(lChildrenItem) #Выполнить рекурсивный вызов (уменьшение количества спецификаций), если спецификация больше одного элемента + #????????Зачем в условии ниже is not None ??????????? if len(inSpecificationList)>1 and len(lChildrenList)>0 is not None: #Вызвать рекурсивно функцию получения следующего объекта, если в спецификации есть следующий объект for lChildElement in lChildrenList: - lResultList.extend(UIOSelector_Get_UIOList(inSpecificationList[1:],lChildElement)) + lResultList.extend(UIOSelector_Get_UIOList(inSpecificationList[1:],lChildElement,inFlagRaiseException)) else: lResultList.extend(lChildrenList) + #Условие, если результирующий список пустой и установлен флаг создания ошибки (и inElement is None - не следствие рекурсивного вызова) + if inElement is None and len(lResultList)==0 and inFlagRaiseException: + raise pywinauto.findwindows.ElementNotFoundError("Robot can't find element by the UIOSelector") return lResultList ################################################################################################# #Get first (in more than one) UIO (UI Object) #inSpecificationList - UIOSelector +#inElement - Входной элемент - показатель, что не требуется выполнять коннект к процессу +#inFlagRaiseException - Флаг True - выкинуть ошибку в случае обнаружении пустого списка #old name - PywinautoExtElementGet -def UIOSelector_Get_UIO (inSpecificationList,inElement=None): +def UIOSelector_Get_UIO (inSpecificationList,inElement=None,inFlagRaiseException=True): lResult=None #Получить родительский объект если на вход ничего не поступило - lResultList=UIOSelector_Get_UIOList(inSpecificationList,inElement) + lResultList=UIOSelector_Get_UIOList(inSpecificationList,inElement,False) if len(lResultList)>0: lResult=lResultList[0] - else: + #Условие, если результирующий список пустой и установлен флаг создания ошибки (и inElement is None - не следствие рекурсивного вызова) + if lResult is None and inFlagRaiseException: raise pywinauto.findwindows.ElementNotFoundError("Robot can't find element by the UIOSelector") return lResult - +################################################################################################# +#Check if UIO exist (Identified by the UIOSelector) +#inSpecificationList - UIOSelector +#old name - - +def UIOSelector_Exist_Bool (inSpecificationList): + lResult=False + #Получить родительский объект если на вход ничего не поступило + lResultList=UIOSelector_Get_UIOList(inSpecificationList,inElement,False) + if len(lResultList)>0: + lResult=True + return lResult +################################################################################################# +#Wait for UIO is appear (at least one of them or all at the same time) +#inSpecificationListList - List of the UIOSelector +#inWaitSecs - Время ожидания объекта в секундах +#inFlagWaitAllInMoment - доп. условие - ожидать появление всех UIOSelector одновременно +#return: [0,1,2] - index of UIOSpecification, which is appear +#old name - - +def UIOSelectorsSecs_WaitAppear_List (inSpecificationListList,inWaitSecs,inFlagWaitAllInMoment=False): + lResultFlag=False + lSecsSleep = 1 #Настроечный параметр + lSecsDone = 0 + lResultList = None + #Цикл проверки + while lResultFlag == False and lSecsSleep0: + #Условие выполнено + lResultFlag=True + #Если флаг не изменился - увеличить время и уснуть + if lResultFlag == False: + lSecsDone=lSecsDone+lSecsSleep + sleep(lSecsSleep) + return lResultList +################################################################################################# +#Wait for UIO is appear (at least one of them or all at the same time) +#inSpecificationList - UIOSelector +#inWaitSecs - Время ожидания объекта в секундах +#return: Bool - True - UIO is appear +#old name - - +def UIOSelectorSecs_WaitAppear_Bool (inSpecificationList,inWaitSecs): + lWaitAppearList=UIOSelectorsSecs_WaitAppear_List([inSpecificationList],inWaitSecs) + lResult=False + if len(lWaitAppearList)>0: + lResult=True + return lResult ################################################################################################# #Get process bitness (32 or 64) #inSpecificationList - UIOSelector