List of Keyword - System Keywords 4


To learn how to use System keywords in Opkey, you can read Using System Keywords - New UI and Using System Keywords - Opkey Classic.
 

Now, let's go through the list of various system keywords to understand their utility.

 


1. SetValueToCSV 


This keyword updates the value in a CSV file where the starting row and column indexes are “1”. It takes “CSVFilePath”, “row number”, “column number” and “Value to set” as input parameters. Using this keyword you can set value to “.csv” extension type files. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Input Value

Required 

This keyword requires the following data arguments as input: 

CSVFilePath: It takes the CSV file's path with the extension ".csv" (e.g. "D: EXECUTION TEST FILECSVFile.csv") 

rowNumber: Row ID of CSV file starting with index 1. It takes an "Integer" value as input. (e.g. "2") 

columnNumber: Column ID of CSV file starting with index 1. It takes an "Integer" value as input. (e.g. "2") 

Value to set: It takes the value which is to be set. It takes the "String" value as the input.



Output Data

  

                         Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False



Error conditions 


Condition 

Message 

Debug Info 

Invalid Data 

CSVFilePath: D: 

row number: 2 

columnNumber: 2 

Value to set: Opkey 

Argument Data Invalid (-13300)  

  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

 
 

 

File not found at D: 

Blank Data 

CSVFilePath: (Blank) 

row number: 2 

columnNumber: 2 

Value to set: Opkey 

Argument Data Missing (-13200)  

  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

 
 

 

One or more of the arguments have not been provided a value 

Blank Data CSVFilePath: (Blank) 

row number: (Blank) 

columnNumber: (Blank) 

Value to set: (Blank) 

Argument Data Missing (-13200)  

  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

 
 

 

One or more of the arguments have not been provided

 

 


2. Function Keywords 

(I). CustomizeObject 


This keyword updates/customizes the properties of the specified object so that execution can be performed on the object even when properties are changed. It takes Property1, Value1, IsRegEx1, Property2, Value2, IsRegEx2, etc. 


This keyword is used to update the object properties. It takes an object input argument and a data input argument. 



Example 

If you want to get the cell value of the specified Shared Global DR, here is how you will use this keyword- 


  • Add CustomizeObject. 

  • Map Object. 

  • Provide Data Input Argument (Property1, Value1 & IsRegEx1) values. 


  • Similarly, provide Data Input Argument values for other object properties to be customized.


In the CustomizeObject Keyword, adding a Test Object argument was required. Hence, we have mentioned it is required.



Test Object


Test Object Required?

Description

Yes

object


Input Data


Input Data Required

Description

                          Property 1

Specify the property name of the mapped object. 

                          Value1

Specify the customized value of the property. 


IsRegEx1 


Specify the IsRegEx value 

Boolean (True/False). 




Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False



Error conditions 


Condition 

Message 

Debug Info 

Object Not Given




Argument Data Missing 

 

 
 

 

Data not provided for argument: 'Object'. Expected StaticValue was empty. 

 

 


(II). GetAllErrorsInSuite 


This keyword generates a status file for all errors that occurred while executing a suite. It takes DirectoryPath and Snap (T/F) as input parameters. As this is a system keyword, there is no need for any plugin to be selected while executing this keyword. 


For example, to generate a status file of a test suite, you can give input parameters in the following manner:-


SetValueToCSV

 

Directory path

D: ExecutionErrors



The output will be the list of errors that occured.


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.



Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

                          Input Data Value

Required 

This keyword requires one data argument as input: 

Directory Path: This argument takes the path of the directory where the error file for failed steps is to be generated. (e.g.: "D: ExecutionErrors") 

Snap(True/False): Setting this option "True" or "False" generates a snapshot for the failed steps at the specified directory. It takes "Boolean" input. 



Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False



Error conditions 


Condition 

Message 

Debug Info 

Invalid Data 

directory-path: ExecutionErrors 

Snap(True/False): False 

  

  

Invalid Data: 

directory-path: ctnl0037ExecutionErrors 

(Location not accessible) 

Snap(True/False): False 

  

  

Blank Data 

directory-path: (Blank) 

Snap(True/False): False 

  

  


(III). GetElementsCountByXpath 


This keyword counts a particular element from the specified XML. It takes FilePath or XML & Xpath as data input arguments.


Example 

If you want to get the cell value of the specified Shared Global DR, here is how you will use this keyword- 


  • Add GetElementsCountByXpath. 

  • Provide Data Input Argument (FilePath or XML & Xpath) values. 


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

                         FilePath or XML 

Specify the XML or map XML File. 

Xpath 


Specify the Xpath of the elements to be counted. 




Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

Element Value

If an error is there

0

 


Error conditions 


Conditions 

Message 

Debug Info 


Invalid File path or XML and Invalid Xpath are given. 


Argument Data Invalid (-13300) 


Data at the root level is invalid. Line1, position. 


No File path or XML & Xpath are given. 


Argument Data Missing (-13200) 


One or more of the arguments have not been provided a value. 


(IV)GetExecutionStatus 


This keyword generates a status file for all suite steps at runtime. It takes the Directory Path as an input parameter. This keyword is mostly used when the user needs an execution status for a suite. 


Example 


For example, if you want to generate a status file for all the suite steps at runtime, then you can use this keyword for the same. 



Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

                         Input Value 

Required 

This keyword requires one data argument as input: 

Directory Path: It takes the path of the directory where the status file for all suite steps is to be generated. (e.g.: "D: ExecutionStatus") 

 



Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False

 


Error conditions 



Conditions 


Message 

Debug Info 


Invalid Data: 

DirectoryPath: XYZ123@!# 


Argument Data Invalid (-13300)  

  

DESCRIPTION:  

The data value for one or more input arguments was not what was expected. This might happen when the input is expected in a specific format or should be chosen from a predefined set of values. Check for spelling errors and capsizing. 


The directory Path was not found 


Invalid Data: 

directory-path: ctnl0037Executionstatus 

(Location not accessible) 



 Blank Data 

 directory-path: (Blank


Argument Data Missing (-13200)  

  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 


 The directory path can't    be blank 





(V). GetScreenHeight 

This keyword retrieves the height of the Screen at runtime. This keyword does not need any input arguments. 


Example

 

For example, if you want to get the height of the screen at runtime, then here is how you can use this keyword for the same. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                         Input Data

This keyword doesn’t take any input data argument.

 


Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False

 



(VI). GetScreenWidth 

This keyword retrieves the width of the Screen at runtime. It does not need any input arguments. 


Example

 

For example, if you want to get the width of the screen at runtime, then here is how you can use this keyword for the same. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                         Input Data

This keyword doesn’t take any input data argument.

 


Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False

 

 

(VII). GeSystemIPAddresst 


This keyword retrieves the current IP Address of the system at runtime. It does not need any input arguments. 


Example 


For example, if you want to find your system’s IP Address at runtime, then here is how you can use this keyword for the same. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                         Input Data

This keyword doesn’t take any input data argument.

 


Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False

 

 

(VIII).GetValueFromJSON

 

This keyword retrieves the parsed value of JSON. Users need to provide the JSON value and its path as the input parameters. 


NOTE: This keyword can be tested in another way i.e. Rest services of Service Repository. 


Example


GetValueFromJson 

 

JSON 

< Provide JSON value as data input argument> 

JSON Path 

Provide JSON path as data input argument> 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                        JSON

Provide the JSON value as a data input argument.

 

JSON Path 


    Provide JSON path as data input argument. 



Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False



Error conditions 


Condition 


Message 

Debug Info 

If the user provides a JSON value and doesn’t provide the path. 

Argument Data Missing (-13200) 

Value cannot be Null. 

If the user provides a null Json value and null Json path. 

Argument Data Missing (-13200) 

One or more of the arguments have not been provided a value. 

 

(IX)GetValueFromXpath 


This keyword retrieves the value from the given XML Xpath, i.e. an XML file should have a file path. It takes three input parameters i.e. file path or XML file, Xpath, and delimits by. 


This keyword is mainly used to fetch XPath values from an XML file. Users can input the XML file path or the XML directly in the data input argument, along with the XPath of the desired XML path. 


NOTE 1: DelimitedBy” it’s an optional part and it is used to get two or more than two values from Xpath values can be separated by anything like comma(, ), semi-colon (: ), etc..  


NOTE 2: There is another way to use this keyword i.e. through Service Repository by adding Soap Services. 


Example

GetValueFromXpath 

 

FilePathOrXML  

< Provide FilePathOrXML as data input argument> 

Xpath  

Provide Xpath as data input argument> 

DelimitedBy 

ProvideDelimitedBy as data input argument> 

 

In the above example, if you want to fetch the XPath value then provide this XML and give XPath i.e. “Prompt” and the value is provided in its output in this way he can use this keyword. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                        FilePathOrXML 

Provide the FilePathOrXML, Xpath, and DelimitedBy as data input arguments. 

NOTE: The user can also provide the Full XML or file path in the data input argument.

 

X Path 

    

Provide Xpath as data input argument. 

                       DelimitedBy 


Provide DelimitedBy as a data input argument. 

NOTE: As DelimitedBy it is an optional part. 



Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False


Error conditions 


Condition 

Message 

Debug Info 


If the user doesn’t provide FilePathOrXML, Xpath, and DelimitedBy. 


Argument Data Missing (-13200) 


One or more of the arguments have not been provided a value. 



 

3. Global Scope Keywords 

(I). ResetORToOriginal 

 

This keyword goes back to the original Object Repository and neutralizes the effect of previously executed SetOR for all subsequent steps generated after the ResetORtoOriginal keyword. It takes no data input argument. 


Example 

This keyword is mostly used in situations where you want to test multilingual websites. 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                        No 


This keyword doesn’t take any data input argument. 

 


Output Data

  

                         
       Condition

                  Output Value

When we execute a Test Case having a Test Step (ResetORtoOriginal) 

Pass

 There are no negative scenarios for this keyword.
                              --


Error conditions 


There are no negative Scenarios for this keyword. 

  

(II). RestoreStepTimeOut 


This keyword restores the default step timeout. It is called before setting the step timeout keyword. It does not require any input argument. 


Example: 

If the user wants to restore its default timeout, then use this keyword. 


RestoreStepTimeOut: 

  

Step Timeout 

No input argument required 


NOTE: There are no error conditions for this keyword.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                        No 


This keyword doesn’t take any data input argument. 

 


Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully 

True



(III). SetGlobalVariableValue 

This keyword is used to set the global variable value at runtime. 


NOTE: 

To set a global variable value at runtime, open a browser with your web application's specified URL and use the "SetGlobalVariableValue" keyword, providing the variable name and variable value. 


Example 

If you want to set the Global variable value “Mozilla Firefox” of the Open browser as “Chrome” then use this keyword as shown- SetGlobalVariableValue 


SetGlobalvariablevalue 

VariableName 

Default Browser 

Variable value 

Chrome 


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any test object argument


Input Data


Input Data Required

Description

                        VairableName

Specify the Global variable 

 

VariableValue

    

     Specify the value 


Output Data

  

                         
       Condition

                  Output Value

If the keyword passes successfully

True

If an error is there

False


Error conditions 


Conditions 

Message 

Debug Information