Conditionals

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

Action

Parameters

Example Usage

ifAlertExists

Web, Mobile


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.  
Param 2 (Default: 60 sec) : Timeout in seconds.

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:

ifAlertExists : <Text: Welcome> <Timeout: 30>

Checks if an alert exists and contains the text "Welcome" and time

 

ifAndroid

Web, Mobile


To execute the next steps if user is executing on an android device.

 

Example

ifAndroid

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

Mobile


To execute the next steps if Bluetooth device having name <PARAM1> is connected.

Param 1 : Name of the device

Example

ifBluetoothDeviceConnected : <Device Name : payPal>

Checks if Bluetooth device payPal is connected.
If the condition is true, the appropriate steps are executed. If not, else part is executed.

ifBluetoothEnabled

Mobile


To execute the next steps if Bluetooth is enabled on device.

 

Example

ifBluetoothEnabled

Checks if Bluetooth is enabled on device. If the condition is true, the appropriate steps are executed.
If not, else part is executed.

ifBluetoothDisabled

Mobile


To execute the next steps if Bluetooth is disabled on device.

 

Example

ifBluetoothDisabled

Checks if Bluetooth is disabled on device.
If the condition is true, the appropriate steps are executed. If not, else part is executed.

ifChecked

Web, Mobile


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

ifChecked : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


To check if object (mentioned in objectName) is disabled and perform appropriate actions only if disabled.

Param 1 : Timeout

Example

ifDisabled : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


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)
Param 2 : Device form (Tablet / Phone)

Example

ifDevice : <Device Type(Android/iOS) : Android > <Form Factor(Tablet/Phone) : Phone>

Checks if the device is an Android Phone or not & performs appropriate actions accordingly.

ifDesktop

Web, Mobile


To execute the next steps if user is executing on desktop.

 

Example

ifDesktop

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

Web Mobile


To execute the next steps if the value (mentioned in Parameter) is decimal.

Param 1 : Value to check

Example

ifDecimal : <Value : 12.8>

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.

ifDecimal : <Object : bqObject> <Value : 12.8>

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

Web, Mobile


To execute the next steps if the value (mentioned in Parameter) is in date format (mentioned in parameter 2).

Param 1 : Date value
Param 2 : Format of the date

Example

ifDate : <Date Value : 02/02/2020> <Date Format : MM/dd/yyyy >

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.

ifDate : <Object : bqObject> <Date Value : 02/02/2020> <Date Format : MM/dd/yyyy

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

Web, Mobile


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
Param 2 : Date Time format

Example

ifDateTime : <Value : 02/02/2020::15:25:45> <Format : dd-MM-yyyy::HH:mm:ss>

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.

ifDateTime : <Object : bqObject> <Value : 02/02/2020::15:25:45> <Format : dd-MM-yyyy::HH:mm:ss>

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

Web, Mobile


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
Param 2 : Text to compare with

 

Example :

ifEqual : <Left Value to Compare : 12> <Right Value to Compare : 12>

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

Web, Mobile


To check if object (mentioned in objectName) is enabled and perform appropriate actions only if it is enabled.

Param 1 : Timeout

 

Example

ifEnabled : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


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

ifElementVisible : <Object : bqObject> <Timeout : 30>

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

Web, Mobile


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

ifElementNotVisible : <Object : bqObject> <Timeout : 30>

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

Web


To check if the variable (variable name in Parameter 1) is empty.

Param 1 : Name if the variable to check

Example

ifEmpty : <Variable Name : Variable1>

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

Web, Mobile


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

ifExcelRowCountEquals : <Total Rows : 20>

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

Web, Mobile


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
Param 2 : Location where the folder is saved

Example

ifFolderExists : <Folder Name : TestFolder> <Location : C:\Users\Public>

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

Web, Mobile


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
Param 2 : Location where the folder is saved

Example

ifFolderDoesNotExist : <Folder Name : TestFolder> <Location : C:\Users\Public>

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

Web, Mobile


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
Param 2 : Location where the file is saved

Example

ifFileExists : <Folder Name : TestFile> <Location : C:\Users\Public>

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

Web, Mobile


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
Param 2 : Location where the file is saved

Example

ifFileDoesNotExist : <Folder Name : TestFile> <Location : C:\Users\Public>

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

Web, Mobile


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
Param 2 : Text to compare with

Example

ifGreaterThan : <Left Value to Compare : 12> <Right Value to Compare : 9>

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

Web, Mobile


To execute the next steps if the value (mentioned in Parameter) is integer. 

Param 1 : Value to check

Example

ifInteger : <Value : 12>

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.

ifInteger : <Object : bqObject> <Value : 12>

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

Web, Mobile


To execute the next steps if user is executing on an iOS device.

 

Example

ifIos

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

Web, Mobile


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
Param 2 : Text to compare with

Example

ifLessThan : <Left Value to Compare : 12> <Right Value to Compare : 15>

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

Web, Mobile


To execute the next steps if user is executing on Linux machine. 

 

Example

ifLinux

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

Web. Mobile


To execute the next steps if user is executing on Mac machine.

 

Example

ifMac

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

Web, Mobile


To check if the variable (variable name in Parameter 1) is not empty. 

Param 1 : Name if the variable to check

Example

ifNotEmpty : <Variable Name : Variable1>

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

Web, Mobile


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

 

Example

ifNotChecked : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


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
Param 2 : Text to compare with

Example:

ifNotEqual : <Left Value to Compare : 12> <Right Value to Compare : 123>

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

Mobile


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
Param 2 : Timeout

Example

ifNotSelectedItemInSpinner : <Object : bqSpinner> <Expected Spinner Item : bqSpinner-1> <Timeout : 30>

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

Web, Mobile


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

 

Example

ifRadioSelected : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


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

 

Example

ifRadioNotSelected : <Object: bqObject> <Timeout: 30>

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

Web, Mobile


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

 

 

Example

ifSelectedInList : <Object: bqObject> <Expected List Item: Must Have>

Checks if Must Have is present in the list on the mentioned object.
If present, selects the item in the list.

ifSelectedItemInSpinner

Mobile


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
Param 2 : Timeout

Example

ifSelectedItemInSpinner : <Object : bqSpinner> <Expected Spinner Item : bqSpinner-1> <Timeout : 30>

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

Web


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 

 

Example

ifTitleEquals : <Title: Login-bqurious>

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

Web


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 

 

Example

ifTitleNotEqual : <Title: Login-bq>

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

Web


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.

Param 1 : Text to verify
Param 2(Optional) : True of False for case sensitive data
Param 3(Optional) : Text for Frame Name / Frame Index

Example

ifTextExists : <Text: Email Address>

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.

ifTextExists : <Object: bqObject> <Text: Email Address>

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

Web


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.

Param 1 : Text to verify
Param 2(Optional) : True of False for case sensitive data
Param 3(Optional) : Text for Frame Name / Frame Index

Example

ifTextDoesNotExist : <Text: Email Address>

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.

ifTextDoesNotExist : <Object: bqObject> <Text: Email Address>

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

Web


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

ifToolTipExists : <Object : bqObject> <Tooltip Text : Add Project>

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

Mobile


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
Param 2 : Timeout

Example

ifTextExistsOnDevice : <Enter Text : Welcome to bqurious> <Timeout(seconds) : 30>

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

Mobile


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
Param 2 : Timeout

Example

ifTabExists : <Object : AssetTabStrip> <Tab Name : Allocation> <Timeout : 30>

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

Mobile


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
Param 2 : Timeout

Example

ifTabNotExist : <Object : AssetTabStrip> <Tab Name : Allocation> <Timeout : 30>

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

Mobile


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
Param 2 : Timeout

Example

ifTabSelected : <Object : AssetTabStrip> <Tab Name : Allocation> <Timeout : 30>

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

Mobile


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
Param 2 : Timeout

Example

ifTabNotSelected : <Object : AssetTabStrip> <Tab Name : Allocation> <Timeout : 30>
Checks if Allocation tab is not selected in Tab Strip AssetTabStrip.
If the condition is true, the appropriate steps are executed. If not, else part is executed.

ifToggleButtonState

Mobile


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)
Param 2 : Timeout

Example

ifToggleButtonState : <Object : bqToggleButton> <Expected Toggle State : TRUE> <Timeout : 30>

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

Web, Mobile


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

 

.

Example

ifWindowWithTitleExists : <Title: Login-bqurious>

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

Web, Mobile


To execute the next steps if user is executing on Windows machine.

 

Example

ifWindows

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.