List of Keywords - System Keywords 3


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 third list of various system keywords to understand their utility.


1. GetFileExtension 

 

This keyword fetches the extension of a specified file by taking the file path as input data parameter. The file path can be provided as a static value, global variable, or through an attachment in the input argument. 

 
 Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 


Data Input Required

Description
File path
Specify the file path with the extension 


Output Data

 

Condition
Output Value

If the keyword passes successfully

Extension of file 

If there is an error

False


Example 


If you want to get the file extension of file test.html from the C: drive of your local device, then use the keyword GetFileExtension with the following path.

 

 

Path 

C:test.html 


It will get the Output .html i.e. extension of the test.html file. 


Error conditions 

Conditions 

Message 

Debug Information 

If provided with a Null Path 

< Argument Data Missing (-13200) > 

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

If provided with a path that does not exist 

Argument Data Invalid (-13300) 

System.IO.FileNotFoundException: Could not find a part of the path C:UsersaishwaryaDesktopdoc.doc 

File name: 'C:UsersaishwaryaDesktopdoc.doc' 

at A.cdb444caf4f5ad03e34dc7fb63812 

7381.c1025fe81511a868364fbb0c6e 

6f996b9(String c81276ea65115095562f9860658 

a83374) in File681:line 257 

 

2. GetFileName 

 

This keyword fetches the name of a specified file with its extension by taking the file path as input. The File path can be provided as a static value, global variable, or through an attachment in Input Argument. 


Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 


Data Input Required

Description
File path
Specify the file path of the file whose name you want to fetch 


Output Data

 

Condition
Output value

If the keyword passes successfully

Name of file with extension

If there is an error

False


Example 


If we want to get the filename with an extension of file test.html from C: drive, then we use the keyword GetFileName with the following path name. 


Path 

C:test.html 


It will get the output test.html i.e. filename with an extension of test.html file. 


Error conditions
 

Conditions 

Message 

Debug Information 

If provided path without extension 

  

  

If provided with a Null Path 

< Argument Data Missing (-13200) > 

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

If the file doesn’t exist 

Argument Data Invalid (-13300) 

System.IO.FileNotFoundException: Could not find a part of the path C:UsersADesktopdoc.doc 

File name: 'C:UsersaishwaryaDesktopdoc.doc' 

at A.cdb444caf4f5ad03e34dc7fb 

638127381.c71b75821a828d689d 

c331e07040f3abb(String c81276ea65115095562f9860658a 

83374) in File681:line 14 

 

3. GetFileNameWithoutExtension 

 

This keyword fetches the name of a specified file without its extension by taking the file path as input. The File path can be provided as a static value, global variable, or through an attachment in Input Argument. 


Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 


Data Input Required

Description
File path
Specify the file path of the file whose name you want to fetch without its extension


Output Data

 

Condition
Output Value

If the keyword passes successfully

Name of file without extension

If there is an error

False


Example 


If we want to get the filename without an extension of File test.html from C:drive, then use the keyword GetFileNamewithoutExtension with the following path name. 


Path 

C:test.html 


It will get the output test i.e. filename without the extension name. 


Error conditions

 

Conditions 

Message 

Debug Information 

If provided with a Null Path 

< Argument Data Missing (-13200) > 

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

If provided with a file that does not exist 

Argument Data Invalid (-13300) 

System.IO.FileNotFoundException: Could not find a part of the path C:UsersaishwaryaDesktopdoc.doc 

File name: 'C:UsersaishwaryaDesktopdoc.doc 

at A.cdb444caf4f5ad03e34dc7fb6381 

27381 .c79f01309a5b360dea40b4a5ce9fa 

05dc (String c81276ea65115095562f9860658 

a83374) in File681:line 196 

 

4. GetFilePath 

 

This keyword fetches the path of a specified file, taking the file itself as an input parameter. The file path can be provided as a static value, through a global variable, or as an attachment in the input argument. 

 
 

Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
File
Select the file whose path you want to fetch


Output Data

 

Condition
Output Value

If the keyword passes successfully

File path of the selected file

If there is an error

False


Example 


If we want to get the file path of the file Opkey.txt from C: drive, then use the keyword GetFilePath and select the Opkey.txt file. It will give the output file path name of the selected file.


Error conditions 

Conditions 

Message 

Debug Information 

If no file is selected 

< Argument Data Missing (-13200) > 

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

 

5. GetFileSize 

This keyword fetches the size of a specified file, taking the file path as input. The file path can be provided as a static value, through a global variable, or as an attachment in the input argument. 


Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
File
Select the file whose file size you want to fetch


Output Data

 

Condition
Output Value

If the keyword passes successfully

File size of the selected file

If there is an error

False


Example 


If we want to get the file path of the file test.html from C: drive, then use the keyword and add the file path as shown.

Path 

C:test.html 


It will get the file size of the test.html file. 


Error conditions
 

Conditions 

Message 

Debug Information 

If provided with a Null Path 

< Argument Data Missing (-13200) > 

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

If the file doesn’t exist 

Argument Data Invalid (-13300) 

System.IO.FileNotFoundException: Could not find a part of the path C: UsersNew Text Document 

File name: 'C:UsersText Document' 

at A.cdb4 in File681:line 174 

 

6. GetValueFromCSV 

 

This keyword extracts a value from a CSV file and requires the following input parameters: CSVFilePathrowNumber, and columnNumber File path can be provided as static value or through Global variable and Attachment in Input Argument. 

Test Object 


Object Input  Required

Description
No
Object Input data is not required.



Input Data

 Input Data Required

 Description 

 

CSVFilepath 

 Specify the Path of the file with the .csv extension from which you want to get value. 

 Row Number

 Specify the Row number from where you want to get value. 

 Column Number

 Specify the Column number from where you want to get value. 



Output Data

Condition
Output value

If the keyword passes successfully

Value from the specified address in the CSV file

if there is an error

False




Example 

 

Suppose, if we want to get value from a CSV file named .FL_insurance_sample.csv which is in Folder Aishwarya in C: then use the keyword as shown below. 

 

CSVFilePath 

C:Usersaishwarya._FL_insurance_sample.csv 

row number 

1 

column number 

1 


Error conditions 

 

Conditions 

Message 

Debug Information 

If provided with an Invalid Path 

< Argument Data Invalid (-13300) > 

CSVFile path should contain the file name with .csv extension 

If provided with a a Null Path 

< Argument Data Missing (-13200) > 

The file Path argument is missing. 

If the Given File doesn’t exist 

Argument Data Invalid (-13300) 

File not found ‘C: UsersUsername 

Desktop._FL_insurance_sample.csv’ 

If provide an invalid row and column 

Argument Data Invalid (-13300) 

The minimum value for Row and Column is 1 

 

7. ReadTextFile 

 

This keyword reads any specified file with the file path containing its name and a .txt extension. It takes FilePath as a data input argument.  

Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
File path

Provide the full file path. Ensure that the file has .txt extension.



Output Data

 

Condition
Output Value

If the keyword passes successfully

Mapped the file with the  .txt extension 

If there is an error

False


Example 

This keyword is used in situations where you want to read text written in the given text file. 

  

Error conditions 

 

Scenarios 

Error Message 

Debug Information 

If the mapped file has other than a .txt file extension 

Argument Data Invalid 

Given file is not a .txt file 

 

8. RenameFile 

 

This keyword renames a specified file. It takes FilePath and NewFileName as data input arguments. 

 

Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
File path

Provide the full file path. Ensure that the file has .txt extension.

New File Name
Add the new file name.


Output Data

 

Condition
Output Value

If the keyword passes successfully

True

If there is an error

False


Example 

 

This keyword is used in situations where you want to read text written in the given text file. 

 

Error conditions 

Scenarios 

Error Message 

Debug Information 

Given file path doesn’t exist 

Argument Data Invalid 

Not a valid file path 

File path and New File name Not Given 

Argument Data Missing (-13200) 

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

 


9. SearchTextInFile 

This keyword is used for searching a particular text written on the selected file. It takes FilePath, SearchString, and IgnoreCase (True/False) as input parameters.

 

Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
File path

It takes the file's path with the extension ".txt" (e.g.: "D:EXECUTION TEST FILEText file.txt") 

SearchString
This field takes the string to be searched in the specified file. It takes the "String" value as input. (e.g. : "Opkey")
IgnoreCase
Setting this option "True" or "False" decides whether case sensitivity is to be considered while searching string. It takes "Boolean" input.


Output Data

 

Condition
Output Value

If the keyword passes successfully

True

If there is an error

False



Error conditions 

 

Condition 

Message 

Debug Info 

Valid Data 

FilePath: D: EXECUTION TEST FILEDocFile.doc 

SearchString: opkey 

IgnoreCase: True 

Argument Data Invalid (-13300)  

  

DESCRIPTION:  

One or more input arguments have unexpected data values, possibly due to a specific format requirement or a predefined set of values. Check for spelling errors and capitalization. 

Given file is not a Txt file 

Valid Data 

FilePath: d-195Text file.txt  

(Location not accessible) 

SearchString: opkey 

IgnoreCase: True 

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. 

Not a valid file path 

Invalid Data 

FilePath: D: EXECUTION TEST FILE 

SearchString: OPKEY 

IgnoreCase: True 

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. 

Not a valid file path 

Blank Data  

FilePath: (Blank) 

SearchString: (Blank) 

IgnoreCase: False 

Argument Data Missing (-13200)  

  

DESCRIPTION:  

A step cannot be executed if one or more arguments lack values. Compulsory arguments, unlike optional ones, require data input, which can be statically entered, derived from a previous step's output, a global variable, etc. Leaving compulsory arguments blank is not allowed. 

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

 

10. SetCellValueToExcel 

 

This keyword sets a value in an Excel file (".xls" or ".xlsx" extension) at the specified row and column indexes. Input parameters include ExcelFilePath, Sheet name, row number, column number, and the new value to set. 

Test Object


Object Input  Required

Description
No
Object Input data is not required.



Input Data 

Data Input Required

Description
ExcelFilepath

It takes the Excel file's path with the extension ".xls" or ".xlsx" (e.g. "D:ExcelFile.xls" or "D:ExcelFile.xlsx")  

sheetName
Specified Excel sheet name on which modification is to be done. It takes the "String" value as input. (e.g.: "Sheet1")
rowNumber
Row ID of Excel file starting with index 1. It takes an "Integer" value as input. (e.g. "2") 
columnNumber
Column ID of Excel file starting with index 1. It takes an "Integer" value as input. (e.g. "2") 
Value to set
It takes the value that is to be set in the cell address. It takes the "String" value as input.  


Output Data

 

Condition
Output Value

If the keyword passes successfully

True

If there is an error

False



Error conditions 

 

Condition 

Message 

Debug Info 

Invalid Data 

ExcelFilePathD:ExcelFile.xlsx 

SheetName: Sheet1 

row number: 0 

columnNumber: 0 

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. 

 

The minimum value for a Row or Column is 1 

Invalid Data 

ExcelFilePath: D: 

SheetName: Sheet1 

row number: 2 

columnNumber2 

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. 

 

The file could not be accessed. Try one of the following: 

  

• Make sure the specified folder exists.  

• Make sure the folder that contains the file is not read-only. 

• Make sure the file name does not contain any of the following characters:  <  > ? [  ] :  | or  * 

• Make sure the file/path name doesn't contain more than 218 characters or more of the arguments have not been provided a valid value 

Invalid Data 

ExcelFilePathD:ExcelFile.xlsx 

SheetName: Sheet5 

row number: 2 

columnNumber2 

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. 

 

Sheet name Sheet5 doesn't exist 

Blank Data ExcelFilePath: (Blank) 

SheetName: (Blank) 

row number: (Blank 

columnNumber: (Blank) 

Value to set: (Blank) 

Argument Data Missing (-13200)  

  

DESCRIPTION:  

A step cannot be executed if one or more arguments lack values. Compulsory arguments, unlike optional ones, require data input, which can be statically entered, derived from a previous step's output, a global variable, etc. Leaving compulsory arguments blank is not allowed. 

 

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

 

Click here to go through the fourth list of system keywords in Opkey.



To learn how you can actually use these keywords in test scenarios, you can visit https://university.opkeylms.com and enroll in our Opkey series course.

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article