Mainframe3270
To give time for the mainframe screen to be "drawn" and receive the next commands, a "wait time" has been created, which by default is set to 0.5 seconds. This is a sleep applied AFTER the following keywords:
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
wait_time | timedelta | null |
If you want to change this value, just use this keyword passing the time in seconds.
Examples
Change Wait Time | 0.5 |
Change Wait Time | 200 milliseconds |
Change Wait Time | 0:00:01.500 |
To give the user time to see what is happening inside the mainframe, a "wait time after write" has been created, which by default is set to 0 seconds. This is a sleep applied AFTER sending a string in these keywords:
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
wait_time_after_write | timedelta | null |
If you want to change this value, just use this keyword passing the time in seconds.
Note: This keyword is useful for debug purpose
Examples
Change Wait Time After Write | 1 |
Change Wait Time After Write | 0.5 seconds |
Change Wait Time After Write | 0:00:02 |
Close all currently opened connections and reset the index counter to 1.
Close the current connection.
Delete the character under the cursor. If you want to delete a character that is in another position, simply pass the coordinates ypos
/ xpos
.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
ypos | int, None | None | |
xpos | int, None | None |
Coordinates are 1 based, as listed in the status area of the terminal.
Examples
Delete Char | ||
Delete Char | ypos=9 | xpos=25 |
Delete the entire content of a field at the current cursor location and positions the cursor at beginning of field. If you want to delete a field that is in another position, simply pass the coordinates ypos
/ xpos
of any part in the field.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
ypos | int, None | None | |
xpos | int, None | None |
Coordinates are 1 based, as listed in the status area of the terminal.
Examples
Delete Field | ||
Delete Field | ypos=12 | xpos=6 |
Execute a x3270 command.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
cmd | str | null |
Examples
Execute Command | Enter |
Execute Command | Home |
Execute Command | Tab |
Execute Command | PF(1) |
Move the cursor to the next input field. Equivalent to pressing the Tab key.
Move the cursor to the previous input field. Equivalent to pressing the Shift+Tab keys.
Create a connection to an IBM3270 mainframe with the default port 23. To establish a connection, only the hostname is required. Optional parameters include logical unit name (LU) and port.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
host | str | null | |
LU | str, None | None | |
port | int | 23 | |
extra_args | List[str], PathLike, None | None | |
alias | str, None | None |
Additional configuration data can be provided through the extra_args parameter. extra_args accepts either a list or a path to a file containing x3270 command line options.
Entries in the argfile can be on one line or multiple lines. Lines starting with "/docs/libraries/3rd-party-libraries/mainframe3270#" are considered comments. Arguments containing whitespace must be enclosed in single or double quotes.
Please ensure that the arguments provided are available for your specific x3270 application and version. Refer to the wc3270 command line options for a subset of available options.
Note: If you specify the port with the -port command-line option in extra_args (or use the -xrm resource command for it), it will take precedence over the port argument provided in the Open Connection keyword.
This keyword returns the index of the opened connection, which can be used to reference the connection when switching between connections using the Switch Connection keyword. For more information on opening and switching between multiple connections, please refer to the Concurrent Connections section.
Examples
Open Connection | Hostname | ||||
Open Connection | Hostname | LU=LUname | |||
Open Connection | Hostname | port=992 | |||
@{extra_args} | Create List | -accepthostname | myhost.com | -cafile | ${CURDIR}/cafile.crt |
Append To List | ${extra_args} | -port | 992 | ||
Open Connection | Hostname | extra_args=${extra_args} | |||
Open Connection | Hostname | extra_args=${CURDIR}/argfile.txt | |||
Open Connection | Hostname | alias=my_first_connection |
Create a connection to an IBM3270 mainframe using a session file.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
session_file | PathLike | null | |
alias | str, None | None |
The session file contains resources (settings) for a specific host session.
The only mandatory setting required to establish the connection is the hostname resource.
This keyword is an alternative to Open Connection. Please note that the Robot-Framework-Mainframe-3270-Library currently only supports model "2". Specifying any other model will result in a failure.
For more information on session file syntax and detailed examples, please consult the x3270 wiki.
This keyword returns the index of the opened connection, which can be used to reference the connection when switching between connections using the Switch Connection keyword. For more information on opening and switching between multiple connections, please refer to the Concurrent Connections section.
Examples
Open Connection From Session File | ${CURDIR}/session.wc3270 |
where the content of session.wc3270 is:
Assert that all the strings in a given list exist on the mainframe screen.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
list_string | List[str] | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Contain All Strings | ${list_of_string} | |
Page Should Contain All Strings | ${list_of_string} | ignore_case=True |
Page Should Contain All Strings | ${list_of_string} | error_message=New error message |
Assert that one of the strings in a given list exists on the mainframe screen.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
list_string | List[str] | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Contain Any String | ${list_of_string} | |
Page Should Contain Any String | ${list_of_string} | ignore_case=True |
Page Should Contain Any String | ${list_of_string} | error_message=New error message |
Assert that the text displayed on the mainframe screen matches the given pattern.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
ignore_case | bool | False | |
error_message | str, None | None |
Pattern matching is similar to matching files in a shell, and it is always case-sensitive. In the pattern, * matches anything and ? matches any single character.
Note that for this keyword the entire screen is considered a string. So if you want to search for the string "something" and it is somewhere other than at the beginning or end of the screen, it should be reported as follows: *something*
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Contain Match | *something* | |
Page Should Contain Match | *so???hing* | |
Page Should Contain Match | *someTHING* | ignore_case=True |
Page Should Contain Match | *something* | error_message=New error message |
Assert that a given string exists on the mainframe screen.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Contain String | something | |
Page Should Contain String | someTHING | ignore_case=True |
Page Should Contain String | something | error_message=New error message |
Asserts that the entered string appears the desired number of times on the mainframe screen.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
number | int | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Contain String X Times | something | 3 | |
Page Should Contain String X Times | someTHING | 3 | ignore_case=True |
Page Should Contain String X Times | something | 3 | error_message=New error message |
Fails if string does not match pattern as a regular expression. Regular expression check is implemented using the Python re module. Python's regular expression syntax is derived from Perl, and it is thus also very similar to the syntax used, for example, in Java, Ruby and .NET.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
regex_pattern | str | null |
Backslash is an escape character in the test data, and possible backslashes in the pattern must thus be escaped with another backslash (e.g. \\d\\w+).
Fails if one of the strings in a given list exists on the mainframe screen. If one of the string are found, the keyword will raise an exception.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
list_string | List[str] | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Not Contain All Strings | ${list_of_string} | |
Page Should Not Contain All Strings | ${list_of_string} | ignore_case=True |
Page Should Not Contain All Strings | ${list_of_string} | error_message=New error message |
Assert that none of the strings in a given list exists on the mainframe screen. If one or more of the string are found, the keyword will raise an exception.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
list_string | List[str] | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Not Contain Any Strings | ${list_of_string} | |
Page Should Not Contain Any Strings | ${list_of_string} | ignore_case=True |
Page Should Not Contain Any Strings | ${list_of_string} | error_message=New error message |
Assert that the text displayed on the mainframe screen does NOT match the given pattern.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
ignore_case | bool | False | |
error_message | str, None | None |
Pattern matching is similar to matching files in a shell, and it is always case-sensitive. In the pattern, * matches anything and ? matches any single character.
Note that for this keyword the entire screen is considered a string. So if you want to search for the string "something" and it is somewhere other than at the beginning or end of the screen, it should be reported as follows: *something*
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Not Contain Match | *something* | |
Page Should Not Contain Match | *so???hing* | |
Page Should Not Contain Match | *someTHING* | ignore_case=True |
Page Should Not Contain Match | *something* | error_message=New error message |
Assert that a given string does NOT exist on the mainframe screen.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
ignore_case | bool | False | |
error_message | str, None | None |
The assertion is case-sensitive. If you want it to be case-insensitive, you can pass the argument ignore_case=True.
You can change the exception message by setting a custom string to error_message.
Examples
Page Should Not Contain String | something | |
Page Should Not Contain String | someTHING | ignore_case=True |
Page Should Not Contain String | something | error_message=New error message |
Fails if string does match pattern as a regular expression. Regular expression check is implemented using the Python re module. Python's regular expression syntax is derived from Perl, and it is thus also very similar to the syntax used, for example, in Java, Ruby and .NET.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
regex_pattern | str | null |
Backslash is an escape character in the test data, and possible backslashes in the pattern must thus be escaped with another backslash (e.g. \\d\\w+).
Get a string of length
at screen coordinates ypos
/ xpos
.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
ypos | int | null | |
xpos | int | null | |
length | int | null |
Coordinates are 1 based, as listed in the status area of the terminal.
Example for read a string in the position y=8 / x=10 of a length 15:
${value} | Read | 8 | 10 | 15 |
Read the current screen and returns all content in one string.
This is useful if your automation scripts should take different routes depending on a message shown on the screen.
Examples
${screen} | Read All Screen |
IF | 'certain text' in '''${screen}''' |
Do Something | |
ELSE | |
Do Something Else | |
END |
This keyword lets you change the keyword that runs on failure during test execution. The default is Take Screenshot, which is set on library import.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
keyword | str | null |
You can set None
to this keyword, if you do not want to run any keyword on failure.
Examples
Register Run On Failure Keyword | None | # no keyword is run on failure |
Register Run On Failure Keyword | Custom Keyword | # Custom Keyword is run on failure |
Send an Enter to the screen.
Set a folder to keep the html files generated by the Take Screenshot keyword.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | str | null |
Note that the folder needs to exist before running your automation scripts. Else the images will be stored in the ${OUTPUT DIR}
set by robotframework.
Examples
Set Screenshot Folder | C:\\Temp\\Images |
Switch the current connection to the one identified by index or alias. Indices are returned from and aliases can be optionally provided to the Open Connection and Open Connection From Session File keywords.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
alias_or_index | str, int | null |
For more information on opening and switching between multiple connections, please refer to the Concurrent Connections section.
Examples:
Open Connection | Hostname | alias=first | |
Open Connection | Hostname | alias=second | # second is now the current connection |
Switch Connection | first | # first is now the current connection |
Generate a screenshot of the IBM 3270 Mainframe in a html format. The default folder is the log folder of RobotFramework, if you want change see the Set Screenshot Folder.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
height | int | 410 | |
width | int | 670 | |
filename_prefix | str | screenshot |
The Screenshot is printed in an iframe log, with the values of height=410 and width=670, you can change these values by passing them to the keyword.
The file name prefix can be set, the default is "screenshot".
The full file path is returned.
Examples
${filepath} | Take Screenshot | ||
${filepath} | Take Screenshot | height=500 | width=700 |
Take Screenshot | height=500 | width=700 | |
Take Screenshot | filename_prefix=MyScreenshot |
Wait until the screen is ready, the cursor has been positioned on a modifiable field, and the keyboard is unlocked.
Sometimes the server will "unlock" the keyboard but the screen will not yet be ready. In that case, an attempt to read or write to the screen will result in a 'E' keyboard status because we tried to read from a screen that is not ready yet.
Using this method tells the client to wait until a field is detected and the cursor has been positioned on it.
Wait until a string exists on the mainframe screen to perform the next step. If the string does not appear in 5 seconds, the keyword will raise an exception. You can define a different timeout.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
txt | str | null | |
timeout | timedelta | 0:00:05 |
Examples
Wait Until String | something | |
Wait Until String | something | 10 |
Wait Until String | something | 15 s |
Wait Until String | something | 0:00:15 |