Conditional actions help you to execute steps only if certain conditions are met. For example, you want to click on a button only if it the page has title “Click Me”.
ifTitleEquals “ClickMe”
Click button
EndIf
Structure :
if<Condition> <parameters>
<Steps to execute if condition is true>
elseIf (Optional)
<Steps to execute if condition is false>
endif
For the keywords under this list :
If element is not found or the element is invalid, the keyword will hard fail.
For all other negative scenarios, the keyword will soft fail.
Action | Parameters | Example Usage |
---|---|---|
ifAlertExists
Check if an alert with a given text exists on the screen. If an alert is found then the following statements are executed. | Param 1 (Optional): Text to check in the alert. If param 1 is left blank, the condition will check if any alert is present irrespective of the content. The condition will fail if an alert is not found within timeout. | Example:
Checks if an alert exists and contains the text "Welcome" and time |
ifAndroid
To execute the next steps if user is executing on an android device. | Example
Checks if the user is executing test on an Android device or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifBluetoothDeviceConnected
To execute the next steps if Bluetooth device having name <PARAM1> is connected. | Param 1 : Name of the device | Example
Checks if Bluetooth device payPal is connected. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifBluetoothEnabled
To execute the next steps if Bluetooth is enabled on device. | Example
Checks if Bluetooth is enabled on device. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifBluetoothDisabled
To execute the next steps if Bluetooth is disabled on device. | Example
Checks if Bluetooth is disabled on device. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifChecked
To check if object (mentioned in objectName) is checked and perform appropriate actions only if element is checked. | Param 1 (Default : 60 sec): Timeout in seconds If the condition is found to be true within 30 sec, the if block will be executed otherwise else part will be executed. | Example
Checks if the checkbox is checked on the object element 'bqObject'. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifDisabled
To check if object (mentioned in objectName) is disabled and perform appropriate actions only if disabled. | Param 1 : Timeout | Example
Checks if the mentioned object is disabled or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifDevice
To validate that the current device is of type defined in Param 1 and has a form factor defined in Param 2. | Param 1 : Type of device (Android / iOS) | Example
Checks if the device is an Android Phone or not & performs appropriate actions accordingly. |
ifDesktop
To execute the next steps if user is executing on desktop. | Example
Checks if the user is executing test on the Desktop or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifDecimal
To execute the next steps if the value (mentioned in Parameter) is decimal. | Param 1 : Value to check If test object (mentioned in bqObject) is provided, then it checks if the value of the object is decimal or not. Precedence will be on object value. | Example
Checks if the value is a decimal or not. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if the value 12.8 on the object bqObject is a decimal or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifDate
To execute the next steps if the value (mentioned in Parameter) is in date format (mentioned in parameter 2). | Param 1 : Date value If test object (mentioned in bqObject) is provided, then check if the value of object is in valid date format (mentioned in Parameter 2). Precedence will be on object value. | Example
Checks if the date value mentioned 02/02/2020 matches the provided date format MM/dd/yyyy. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if the date value mentioned 02/02/2020 , on the object bqObject, matches the provided date format MM/dd/yyyy. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifDateTime
To execute the next steps if the value (mentioned in Parameter) is in date time format (mentioned in parameter 2). | Param 1 : Date Time value If test object (mentioned in bqObject) is provided, then check if the value of object is in valid date format (mentioned in Parameter 2). Precedence will be on object value. | Example
Checks if the date time value mentioned 02/02/2020::15:25:45 matches the provided date time format dd-MM-yyyy::HH:mm:ss. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if the date value mentioned 02/02/2020 , on the object bqObject, matches the provided date format MM/dd/yyyy. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifEqual
To compare the specified value in Parameter 1 with Parameter 2 and perform appropriate actions only if both are equal. | Param 1 : Source text to compare If either of the Params are left blank, null values will be compared. | Example :
Checks if value in param 1 is equal to the value in param 2 or not. If condition is true, if block is executed. If not, else block is executed. |
ifEnabled
To check if object (mentioned in objectName) is enabled and perform appropriate actions only if it is enabled. | Param 1 : Timeout | Example
Checks if the mentioned object is enabled or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifElementVisible
To check if object (mentioned in objectName) is visible on the screen and perform appropriate actions only if element is visible. | Param 1 : Timeout | Example
Checks if the element mentioned in bqObject is visible in mentioned timeout time or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifElementNotVisible
To check if object (mentioned in objectName) is not visible on the screen and perform appropriate actions only if element is not visible. | Param 1 : Timeout | Example
Checks that the element mentioned in bqObject is not visible in mentioned timeout time. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifEmpty
To check if the variable (variable name in Parameter 1) is empty. | Param 1 : Name if the variable to check | Example
Checks if the variable stored in Variable1 is empty of not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifExcelRowCountEquals
To compare the total number of rows in the excel file is value (mentioned in Parameter 1) and perform appropriate actions only if it is equal. | Param 1 : Total number of rows | Example
Checks if the excel row count equals 20 or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifFolderExists
To check if folder (mentioned in Parameter 1) exists in file system at location (mentioned in Parameter 2) and perform appropriate actions only if folder exists. | Param 1 : Name of the Folder | Example
Checks if the folder named TestFolder is present at the mentioned location C:\Users\Public or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifFolderDoesNotExist
To check if folder (mentioned in Parameter 1) does not exist in file system at location (mentioned in Parameter 2) and perform appropriate actions only if folder does not exist. | Param 1 : Name of the Folder | Example
Checks that the folder named TestFolder is not present at the mentioned location C:\Users\Public. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifFileExists
To check if file (mentioned in Parameter 1) exists in file system at location (mentioned in Parameter 2) and perform appropriate actions only if file exists. | Param 1 : Name of the File | Example
Checks if the file named TestFile is present at the mentioned location C:\Users\Public or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifFileDoesNotExist
To check if file (mentioned in Parameter 1) does not exist in file system at location (mentioned in Parameter 2) and perform appropriate actions only if file does not exist. | Param 1 : Name of the File | Example
Checks that the file named TestFile is not present at the mentioned location C:\Users\Public. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifGreaterThan
To compare the specified value in Parameter 1 with Parameter 2 and perform appropriate actions only if the value in Parameter 1 is greater than the value in Parameter 2. | Param 1 : Source test to compare If either of the Params are left blank, the keyword will Fail and the execution will stop. | Example
Checks if value in param 1 is greater than param 2 or not. If condition is true, if block is executed. If not, else block is executed. |
ifInteger
To execute the next steps if the value (mentioned in Parameter) is integer. | Param 1 : Value to check If test object (mentioned in bqObject) is provided, then it checks if the value of the object is an integer or not. Precedence will be on object value. | Example
Checks if the value is an Integer or not. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if the value 12 on the object bqObject is an Integer or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifIos
To execute the next steps if user is executing on an iOS device. | Example
Checks if the user is executing test on an iOS device or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifLessThan
To compare the specified value in Parameter 1 with Parameter 2 and perform appropriate actions only if the value in Parameter 1 is less than the value in Parameter 2. | Param 1 : Source text to compare If either of the Params are left blank, the keyword will Fail and the execution will stop. | Example
Checks if value in param 1 is less than param 2 or not. If condition is true, if block is executed. If not, else block is executed. |
ifLinux
To execute the next steps if user is executing on Linux machine. | Example
Checks if the user is executing test on a Linux machine or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifMac
To execute the next steps if user is executing on Mac machine. | Example
Checks if the user is executing test on a Mac machine or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. | |
ifNotEmpty
To check if the variable (variable name in Parameter 1) is not empty. | Param 1 : Name if the variable to check | Example
Checks that the variable stored in Variable1 is not empty. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifNotChecked
To check if object (mentioned in objectName) is unchecked and perform appropriate actions only if element is unchecked. | Param 1 (Default : 60 sec) : Timeout in seconds If the condition is found to be true within 30 sec, the if block is executed otherwise else part is executed. | Example
Checks if the checkbox is not checked on the object element 'bqObject'. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifNotEqual
Compare the specified value in Parameter 1 with Parameter 2 and perform appropriate actions only if both values are not equal. | Param 1 : Source Text to compare If either of the Param values are left blank, null values will be compared. | Example:
Checks if value in param 1 is not equal to the value in param 2 or not. If condition is true, if block is executed. If not, else block is executed. |
ifNotSelectedItemInSpinner
To check if specified item (mentioned in Parameter 1) is not selected in spinner object (mentioned in objectName) and perform appropriate actions only if not selected. | Param 1 : Expected Spinner Item | Example
Checks if bqSpinner-1 is not selected in mentioned object bqSpinner. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifRadioSelected
To check if object (mentioned in objectName) is selected and perform appropriate actions only if the element is selected. | Param 1 (Default : 60 sec): Timeout in seconds If the condition is found to be true within 30 sec, the if block is executed otherwise else part is executed. | Example
Checks if the radio box is selected on the object element 'bqObject'. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifRadioNotSelected
To check if object (mentioned in objectName) is not selected and perform appropriate actions only if the element is not selected. | Param 1 (Default : 60 sec): Timeout in seconds If the condition is found to be true within 30 sec, the if block is executed otherwise else part is executed. | Example
Checks if the radio box is not checked on the object element 'bqObject'. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifSelectedInList
To check if specified value (mentioned in Parameter 1) is selected in object (mentioned in objectName) and perform appropriate actions only if selected. | Param 1 : Expected item in the list If the Param is left blank, else part will be executed. | Example
Checks if Must Have is present in the list on the mentioned object. If present, selects the item in the list. |
ifSelectedItemInSpinner
To check if specified item (mentioned in Parameter 1) is selected in spinner object (mentioned in objectName) and perform appropriate actions only if selected. | Param 1 : Expected Spinner Item | Example
Checks if bqSpinner-1 is selected in mentioned object bqSpinner. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTitleEquals
To check if page title is equal to the specified value (mentioned in Parameter 1) and perform appropriate actions only if condition is true. | Param 1 : Title to compare If the title to check is left blank, else part will be executed. | Example
Checks if the window title is equal to "Login-bqurious" or not. If it does, the appropriate steps are executed. If not, else part is executed. |
ifTitleNotEqual
To check if page title is not equal to the specified value (mentioned in Parameter 1) and perform appropriate actions only if title is different from the value mentioned in Parameter 1. | Param 1 : Title to compare If the title to check is left blank, else part will be executed. | Example
Checks if the window title is not equal to "Login-bq" or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTextExists
To check if text inside the Frame (Frame path or Index mentioned in Parameter 3) with match case exists on page and perform appropriate actions only if text exists. If objectName is mentioned then text will be searched first in the object only. | Param 1 : Text to verify | Example
Checks if text Email Address exists on the webpage. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if text Email Address exists on the mentioned object. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTextDoesNotExist
To check if text inside the Frame (Frame path or Index mentioned in Parameter 3) with match case does not exist on page and perform appropriate actions only if text does not exist. If objectName is mentioned then text will be searched first in the object only. | Param 1 : Text to verify | Example
Checks if text Email Address does not exist on the webpage. If the condition is true, the appropriate steps are executed. If not, else part is executed.
Checks if text Email Address does not exist on the mentioned object. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifToolTipExists
To check if tooltip text (mentioned in Parameter 1) exists in object (mentioned in objectName) and perform appropriate actions only if tooltip exists. | Param 1 : Tooltip text present over the element | Example
Checks that the text Add Project exists over the mentioned object, when mouse hover is performed. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTextExistsOnDevice
To check if text (mentioned in Parameter 1) exists on page and perform appropriate actions only if text exists. If object (mentioned in Object Name) is provided then text will be searched only in object. | Param 1 : Text to verify on the device | Example
Checks if text Welcome to bqurious exists on device page. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTabExists
To check if tab name (mentioned in Parameter 1) exists in TabStrip (mentioned in Object Name) and steps in if block will only be executed if mentioned tab exists. | Param 1 : Name of the Tab | Example
Checks if Allocation tab exists in Tab Strip AssetTabStrip. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTabNotExist
To check if tab name or index (mentioned in Parameter 1) does not exists in TabStrip (mentioned in Object Name) and perform appropriate actions only if tab name does not exists. | Param 1 : Name of the Tab | Example
Checks if Allocation tab does not exist in Tab Strip AssetTabStrip. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTabSelected
To check if tab name (mentioned in Parameter 1) is selected in TabStrip (mentioned in Object Name) and steps in if block will only be executed if mentioned tab is selected. | Param 1 : Name of the Tab | Example
Checks if Allocation tab is selected in Tab Strip AssetTabStrip. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifTabNotSelected
To check if tab name (mentioned in Parameter 1) is not selected in TabStrip (mentioned in ObjectName) and steps in if block will only be executed if mentioned tab is not selected. | Param 1 : Name of the Tab | Example
|
ifToggleButtonState
To check if toggle button (mentioned in ObjectName) state is (State mentioned in Parameter 1)and perform appropriate action only if state is true. | Param 1 : Expected Toggle State (True / False) | Example
Checks if the bqToggleButton status is true or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
ifWindowWithTitleExists
To check if window exists with title (mentioned in Parameter 1) and perform appropriate actions only if the condition is true. | Param 1 : Title to compare If the title to check is left blank, else part will be executed. . | Example
Checks if the window with title "Login-bqurious" exists or not. If it does, the appropriate steps are executed. If not, else part is executed |
ifWindows
To execute the next steps if user is executing on Windows machine. | Example
Checks if the user is executing test on a Windows machine or not. If the condition is true, the appropriate steps are executed. If not, else part is executed. |
0 Comments