출처 : UiPath Academy
Practice 2 - Output Actions & Methods
"Finding the weather using Google"
구글을 사용하여 특정 도시에 날씨를 찾는 로봇을 만든다. 관심 도시는 사용자에 의해 소개된다.
📌 설정방법
- 프로젝트는 Sequence로 시작한다. Input Dialog activity를 사용하여 사용자가 도시 이름을 입력할 수 있도록 한다. 문자열(String) 변수('city')를 생성하여 사용자가 입력한 도시이름을 저장한다.
- Open Browser 컨테이너를 사용하여 Internet Explorer를 열고 Google.com 페이지로 이동한다.
Inside the Container :- Type Into activity를 사용하여 검색창에 city + "날씨"를 입력한다. (city는 위에서 만든 String 변수이다.)
- Send Hotkey activity를 사용하여 'Enter'를 누르고 검색을 시작한다.
- Find Element activity를 사용하여 Google 로고가 표시되는지 확인한다. 결과는 UiElement 유형의 변수를 새로 만들어 저장한다.(변수명 : googleLogoElement)
- If문을 사용하여 Google 로고가 표시됐는지(그리고 검색이 성공했는지)를 확인한다.
Condition은 'IsNothing(googleLogoElement)'일 수 있다. - 조건이 참이라면(검색에 실패함) Log Message activity를 사용하여 오류메시지를 적는다.
(ex. "검색이 잘 되지 않았습니다.") - 조건이 거짓이라면
- Get Full Text activity를 사용하여 화면의 온도를 가져온다. 변수를 새로 생성하여 온도를 저장한다. (변수명 temperature)
- Log Message activity를 사용하여 도시이름과 온도로 메시지를 기록한다.
(ex. city + "의 기온은 " + temperature + "˚C 입니다.")
- Close Tab activity를 사용하여 화면을 닫는다.
1.1 Sequence (Sequence)
Private = False
Variables
city(String)
Activities
1.6 Input Dialog : 사용자 날씨 입력란 (InputDialog)
Title = 도시별 날씨 찾기
Label = 현재 날씨가 궁금한 나라를 적으시오.
IsPassword = False
Result = city
Private = False
1.43 Open Browser (OpenBrowser)
Url = www.google.com
Private = False
Body
1.44 Do (Sequence)
Private = False
Variables
googleLogoElement(UiElement)
temperature(String)
Activities
1.4 Type Into UserWeather날씨 (TypeInto)
Text = city + "날씨"
SimulateType = True
Activate = True
Target
Selector = <webctrl tag='INPUT' type='text' />
Private = False
1.4 Send Hotkey Enter (SendHotkey)
KeyModifiers = None
Key = enter
SpecialKey = True
Activate = True
Target
Selector = <webctrl tag='INPUT' type='text' />
Private = False
1.4 Find Element Google Logo (WaitUiElementAppear)
FoundElement = googleLogoElement
Target
Selector = <webctrl idx='1' tag='IMG' />
ResultType = UiPath.Core.UiElement
Private = False
1.4 If (If)
Condition = isNothing(googleLogoElement)
Private = False
Then
1.7 Log Message (LogMessage)
Message = "검색이 잘 되지 않았습니다.."
LogLevel = Error
Private = False
Else
1.7 Sequence (Sequence)
Private = False
Activities
1.7 Get Full Text 기온 (GetFullText)
Text = temperature
Target
Selector = <webctrl id='wob_tm' tag='SPAN' />
Private = False
1.8 Log Message (LogMessage)
Message = city + "의 기온은 " + temperature + "˚C 입니다."
LogLevel = Info
Private = False
1.4 Close Tab (CloseTab)
Private = False
반응형
'UiPath > UiPath Practice' 카테고리의 다른 글
UI Interactions : Practice 3 - Data Scraping & UI Elements (0) | 2020.11.10 |
---|---|
UI Interactions : Practice 2 - Output Actions & Methods (0) | 2020.11.10 |
UI Interactions : Practice 1 - Input Actions & Methods (0) | 2020.11.09 |
UI Interactions : Demo - Working with UI elements (0) | 2020.11.05 |
UI Interactions : Demo2 - Data Scraping (0) | 2020.11.04 |
댓글