본문 바로가기
UiPath/UiPath Practice

UI Interactions : Demo1 - Part2 : Screen scraping

by kimyosunnyc 2020. 10. 29.

출처 : UiPath Academy

Video Demo 1 - Part2 : Screen scraping

비교를 용이하게 하기 위해 모든 Output Methods를 사용하여 application에서 데이터를 검색한다.

 

Demo1 - Part2 : Screen scraping 설정화면


📌 설정방법

Note : MyCRM앱은 아래 Zip Archive에서 이용할 수 있다.

MyCRM 주소 영역을 표시하기 위해 Screen Scraping Wizard를 사용했다.

Wizard의 미리보기 화면에서 스크래핑 방법으로 OCR을 선택했다. 다음의 Activities는 Screen Scraping Wizard에 의해 생성되었다.

MyCRM.exe
0.06MB

 

  • Attach Window activity로 MyCRM 앱에 연결한다.
  • Attach Window 내에 Get OCR Text는 자동으로 생성 된 GenericValue 변수("GroupingAddress")에 정보를 저장한다.
  • Get OCR Text 내에 Screen Scraping Wizard에서 선택한 OCR엔진은 기존 항목을 삭제하고 Activities 패널에서 새 항목을 추가하여 변경할 수 있다.

UiPath에서 사용할 수 있는 Output Methods를 비교하기 위해 아래에 3가지 Activities를 추가하고, 이에 해당하는 3가지 Sting변수를 만든다. 3가지 Activities 각각의 스크린 영역을 지정하는 대신에 위의 'Get OCR Text' activity의 속성에서 Selector를 복사하고 3가지 Activities의 Selector 속성에 붙여넣는다.

 

  • Get Text activity는 "GetText" 변수
  • Get Full Text activity는 "GetFullText" 변수
  • Get Visible Text activity는 "GetVisibleText"변수

3가지 변수의 값을 인쇄하기 위해 다음과 같은 MethodsWrite Line activity를 사용했다.

"Get Text : " + GetText + Environment.NewLine + "Get Full Text : " + GetFullText + Environment.NewLine + "Get Visible Text : " + GetVisibleText

 

✅ 참고사항

Environment.NewLine은 각 변수를 인쇄하기 전에 다음 행으로 이동하는 데 사용된다.


1.1 ScreenScrapingDemo (Sequence)											
	Private = False										
	Activities										
		1.2 Screen Scraping (Sequence)									
			Private = False								
			Variables								
				GroupingAddress(GenericValue)							
			Activities								
				1.3 Attach Window 'Form1 Mycrm' (WindowScope)							
					Selector = <wnd app='mycrm.exe' ctrlname='Form1' />						
					Private = False						
					Body						
						1.4 Do (Sequence)					
							Private = False				
							Variables				
								GetText(String)			
								GetFullText(String)			
								GetVisibleText(String)			
							Activities				
								1.22 Get OCR Text 'grouping  Address' (GetOCRText)			
									Text = GroupingAddress		
									Target		
										Selector = <wnd ctrlname='tabControl1' /><wnd ctrlname='tabPagePeople' /><wnd ctrlname='groupBox1' /><ctrl name='Address' role='grouping' />	
										WaitForReady = INTERACTIVE	
									Private = False		
									OCREngine		
										1.23 Google OCR (GoogleOCR)	
											Invert = False
											Image = Image
											ExtractWords = False
											Profile = Legacy
											Scale = 2
											Language = eng
											ResultType = System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Drawing.Rectangle,System.String]]
											Private = False
								1.18 Get Text (GetValue)			
									Value = GetText		
									Target		
										Selector = <wnd ctrlname='tabControl1' /><wnd ctrlname='tabPagePeople' /><wnd ctrlname='groupBox1' /><ctrl name='Address' role='grouping' />	
										WaitForReady = INTERACTIVE	
									Private = False		
								1.14 Get Full Text (GetFullText)			
									Text = GetFullText		
									IgnoreHidden = False		
									Target		
										Selector = <wnd ctrlname='tabControl1' /><wnd ctrlname='tabPagePeople' /><wnd ctrlname='groupBox1' /><ctrl name='Address' role='grouping' />	
										WaitForReady = INTERACTIVE	
									Private = False		
								1.10 Get Visible Text (GetVisibleText)			
									Text = GetVisibleText		
									FormattedText = False		
									Target		
										Selector = <wnd ctrlname='tabControl1' /><wnd ctrlname='tabPagePeople' /><wnd ctrlname='groupBox1' /><ctrl name='Address' role='grouping' />	
										WaitForReady = INTERACTIVE	
									Private = False		
								1.5 Write Line (WriteLine)			
									Text = "Get Text: "+ GetText+Environment.NewLine+"Get Full Text"+ GetFullText+Environment.NewLine+"Get Visible Text"+GetVisibleText		
									Private = False		

📌 Output

10/29/2020 12:55:54 => [Debug] Debug started for file: ScreenScraping
10/29/2020 12:55:55 => [Info] UiInteraction_OutputMethods execution started
10/29/2020 12:55:58 => [Debug] Get Text: Address
Get Full TextAddress
Add Line 1:
1049 Park Avenue
Zip Validation
Add Line 2:
Apartment 7G
City:
New York
State:
NY
열기
  
AL
AK
AZ
AR
CA
CO
CT
DE
FL
GA
HI
ID
IL
IN
IA
KS
KY
LA
ME
MD
MA
MI
MN
MS
MO
MT
NE
NV
NH
NJ
NM
NY
NC
ND
OH
OK
OR
PA
RI
SC
SD
TN
TX
UT
VT
VA
WA
WV
WI
WY
Zip:
10028

Get Visible Text1049 Park Avenue

Apartment 7G

New York

NY

10028
10/29/2020 12:55:59 => [Info] UiInteraction_OutputMethods execution ended in: 00:00:03
반응형

댓글