UiPath/UiPath Practice
UI Interactions : Demo1 - Part3 : OCR methods
kimyosunnyc
2020. 10. 29. 14:53
출처 : UiPath Academy
Demo1 - Part3 : OCR methods
OCR methods를 사용하여 application으로부터 데이터를 검색한다.
Note : 이 예에서는 해당 확장 프로그램 없이 Chrome에서 자동화를 개발했다.
이는 UiPath의 UI탐색기(Explorer)가 UI요소(elements)를 인식하지 못하는 application을 시뮬레이션 하기위한 목적으로 수행되었다.
📌 설정방법
- Image Exists activity를 사용하여 Google Search 버튼을 표시한다. 이 activity의 결과(Outcome)는 새로 생성된 Boolean Type의 변수("GoogleSearchImage")에 저장된다.
- Google Search 버튼을 찾는 workflow의 나머지 단계를 조건화 하기 위해 표현식(expression) GoogleSearchImage = True와 함께 If문 activity에서 "GoogleSearchImage"변수를 사용한다.
- Google Search 버튼이 있는지 여부를 나타내기 위해 If activity의 각 branches에 하나씩 Write Line activity를 추가한다.
- 검색창(Search Bar)이 Google Search 버튼에서 안정된 상대적 위치에 있기 때문에, UiPath의 Native Citrix Recorder에서 Text 아래의 Click activity를 사용한다. 전체 이미지를 클릭하면 Screen Scraping Wizard가 열린다.
Wizard에서 Google Search를 검색하고 Set Mouse Position을 사용하여 Google Search 버튼을 찾는다.
그런 다음 화면(screen)에서 Indicate a Point를 사용하여 화면의 검색창을 클릭한다.
Click activity는 wizard의 끝에서 확인할 수 있다. - Attach Window container와 Click Image activity는 wizard에 의해 생성된다.
- Attach Window container와 Activities를 'If Statement'의 True 컨테이너로 이동한다.
- 더 안정적으로 만들기 위해 옵션 메뉴에서 Indicate on Screen을 클릭하고 화면 중간을 클릭하는 대신 브라우저의 상단을 클릭한다. 그런다음 app과 title만 유지하도록 selector를 편집한다.(Selector가 신뢰할 수 있는지 확인하기 위해 유효성을 검사할 수 있음)
- Type Into activity를 사용하여 이 전 activity로 클릭한 검색창에 검색어를 입력한다.
- 또 다른 Click Image activity를 사용하여 화면에 표시 된 Google Search 버튼을 클릭한다.
1.1 OCR Input Output Methods (Sequence)
Private = False
Variables
GoogleSearchImage(Boolean)
Activities
1.31 Image Exists - Google Search Image (ImageFound)
Image
Accuracy = 0.8
Profile = Basic
Found = GoogleSearchImage
Target
Selector = <wnd app='chrome.exe' cls='Chrome_WidgetWin_1' title='Google - Google Chrome' /><wnd aaname='Horizontal' cls='Chrome_RenderWidgetHostHWND' title='Chrome Legacy Window' />
Timeout (milliseconds) = 3000
WaitForReady = INTERACTIVE
ResultType = System.Boolean
Private = False
1.2 If (If)
Condition = GoogleSearchImage = True
Private = False
Then
1.7 Sequence (Sequence)
Private = False
Activities
1.29 Write Line - True (WriteLine)
Text = The image is present
Private = False
1.8 Native Citrix - Simulation (Sequence)
Private = False
Activities
1.9 Attach Window - Google Chrome Window (WindowScope)
Selector = <wnd app='chrome.exe' title='Google - Google Chrome' />
Private = False
Body
1.10 Do (Sequence)
Private = False
Activities
1.17 Click OCR Text - Google Search (ClickOCRText)
CursorPosition
OffsetX = -178
OffsetY = -74
Position = Center
ClickType = CLICK_SINGLE
MouseButton = BTN_LEFT
SendWindowMessages = False
KeyModifiers = None
Text = Google Search
Occurrence = 1
Target
WaitForReady = INTERACTIVE
Private = False
OCREngine
1.18 Tesseract OCR (GoogleOCR)
Invert = False
Image = Image
ExtractWords = True
Profile = Screen
Scale = 2
Language = eng
ResultType = System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Drawing.Rectangle,System.String]]
Private = False
1.15 Type Into - Google Search Bar (TypeInto)
Text = local weather Bucharest
SimulateType = False
SendWindowMessages = False
ClickBeforeTyping = False
EmptyField = False
Activate = True
Target
WaitForReady = INTERACTIVE
Private = False
1.11 Click Image - Google Search Button Image (ClickImage)
Image
Accuracy = 0.8
Profile = Basic
SendWindowMessages = False
KeyModifiers = None
CursorPosition
Position = Center
ClickType = CLICK_SINGLE
MouseButton = BTN_LEFT
Target
Selector = <wnd aaname='Horizontal' cls='Chrome_RenderWidgetHostHWND' title='Chrome Legacy Window' />
WaitForReady = INTERACTIVE
Private = False
Else
1.5 Write Line - False (WriteLine)
Text = The Google Search image is not present
Private = False
반응형