Lesson 12 - Debugging and Exception Handling
忙碌的生活會讓人找藉口,但沒有藉口!
最近發現很多實習的機會要求的都蠻多樣化的,要有自己的project,要會英文,要會開發,要會A也要會B...有時候自己會急著要學A也要B,但slow down!!!
欲速則不達的道理,像是GMAT數學看太快kilometers會變成meters,這樣結果還是會差強人意的!
feat. 上次教一個同學用zero in on + sth,想想這還是我一個很尊敬的老師教我的,學會專注於一件事,別三心二意了!
Error處理重點章節,多用Try catch啊!
第一個重點是要記得把每一個workflow命名,不然錯誤發生時會很難找到錯誤點。
- Yellow highlight: most common, 表是哪個在執行
- Red highlight: effect on current function on other application(只用於input/output)
- property列:表示所有dummy variable
- Detail log:提供第一步錯誤檢視
Input debugging: Application visible→Change input methods(default)→Check selector
- Simulate click:可以看按了什麼看有沒有選錯
- Selector editor:檢查所有selector正確
Timing issue
- Element exists: 會用true/false來找element有沒有存在,如果設置太短會出現false因為可能還沒出現
- Find element:找尋element直到找到為止
要抓到error:Try/ Catches/ Finally
- Catches可以很多個
- System.exception是所有錯誤
- Rethrow會跳出來說錯誤是什麼,但其實可以直接在log message後面打= exception.Message
註:如果要保持Main乾淨,可以新增一個workflow
Where can you find more details about the following error that appears when loading a workflow: “Activity could not be loaded because of errors in the XAML”?
In Outline pane(X)In Output pane
In Properties pane
In the Library
How can you run the process slower in order to analyze the robot’s behavior in certain conditions?
By using Validate.(X)By using Slow Step and running the workflow in Debug mode.
By using Slow Step and starting the workflow normally.(X)
By setting up Breakpoints and running the workflow in Debug mode.(X)
What happens if you put a Breakpoint on a Click activity and start the workflow in Debug mode?
The workflow will throw an error when it reaches that activity.(X)You can only put a Breakpoint on a Break activity.
The workflow will be paused until you click the Continue button.
The workflow will be paused for 5 seconds when it reaches that activity.
How can execution be paused before a particular activity?
By using a Pause activityBy using a MessageBox activity
By using a Break activity
By using a breakpoint in Debug mode
If you want to wait until a UI Element becomes available on the screen, what activity should you use?
Element ExistsWait Element Vanish(X)
Find Element
Can you run the robot manually, step by step, in order to analyze the robot behavior in certain conditions?
No, you cannot do it.(X)Yes, by using Breakpoints and running the workflow in Debug mode.
Yes, by using Step Into and Step Over.
Yes, by running the workflow in Debug mode.(X)
How many Catches can you have in a Try/Catch block?
There is no limit on the number of catches.5
1
2
What is the most effective way to handle the click on a UI Element that is not always available?
By using an Element Exists activity and then a Click activity.By setting the ContinueOnError property of the Click activity to True.
By placing the Click activity inside a Try/Catch block.
If you need to stop the workflow until a UI Element has disappeared from the screen, what activity should you use?
Find Relative Element(X)Wait Element Vanish
Find Element(X)
Element Exists(X)
Where can you see the variables’ values during workflow execution?
In the Variables pane(X)In the Outline pane(X)
In the Locals pane
In the Library pane
What activity can be used in a Citrix environment to check whether a UI element is displayed or not?
Image ExistsElement Exists(X)
Wait Element Vanish(X)
Find Element(X)
When running a workflow how can you see the steps the workflow is executing?
Using Run and inspecting the Properties panelUsing Debug with Highlight Activities option()
Using Debug and inspecting the Output panel()
What is recommended to have in a Catch block?
An Input Dialog activity()A LogMessage activity()
Nothing
An alternative to the approach that fails()
If you need to know if a UI Element is available on the screen or not, what activity should you use?
Element Exists
Find Element
Wait Element Vanish
What can you use to make sure that the execution continues even if an activity fails?
TimeoutMS property
Try/Catch activity()OO
DelayAfter property
Throw activity
When you have more than one exception type defined in the Catch block, which block is executed?
The block with most generic match(X)
The block with most specific match
All matching blocks in the order they are defined(X)
The first match defined(X)
What does the Locals panel display when you are working in Debug mode?
All the activities inside the workflow.(X)
The logs of the workflow.(X)
The current values of your variables.
There is no Locals panel.(X)
The Finally block of a Try/Catch activity is executed when:
The activities in the Try block are executed and had errors.
The activities in the Try block are executed with no error.
The activities in the Catch block are executed and had errors.
Every time, regardless if an exception occurred or not.
SHARE AND LIKE IF IT HELPS
沒有留言:
張貼留言