Functionname: If Else statement
Description: If and else allows you to make conditional statements If the condition is true the if block gets executed. If the condition is false the if else block gets executed
Example:
var Condition = MainWindow.FindControl(title:"Condition");
if (Condition != null)
{
Type("Condition is true");
}
else
{
Type("Condition is not true");
}
Please note:
The else statement is not mandatory.
Challenges:
Finding a control will throw an exception if the control is not found, unless continue on error is enabled this will end the workflow's run.
Solution
It is better to reword the script as a Try Catch statement. This can allow for the removal of inconsistent pop ups, and allows the script to continue if a Control is not found.
Example:
Try{
var Condition = MainWindow.FindControl(title:"Condition");
Condition.Click();
}
catch{
Log("Was unable to find conditional window");
};
Comments
0 comments
Please sign in to leave a comment.