Mainframe3270 is a library for Robot Framework based on the py3270 project, a Python interface to x3270, an IBM 3270 terminal emulator. It provides an API to a x3270 or s3270 subprocess.


For use this library you need to install the x3270 project and put the directory on your PATH. On Windows, you need to download wc3270 and put the "C:\Program Files\wc3270" in PATH of the Environment Variables.


* Settings *
Library           Mainframe3270

* Test Cases *
    Open Connection    Hostname    LUname
    Change Wait Time    0.4 seconds
    Change Wait Time After Write    0.4 seconds
    Set Screenshot Folder    C:\\Temp\\IMG
    ${value}    Read    3    10    17
    Page Should Contain String    ENTER APPLICATION
    Wait Field Detected
    Write Bare    applicationname
    Send Enter
    Take Screenshot
    Close Connection


By default the emulator visibility is set to visible=True. In this case test cases are executed using wc3270 (Windows) or x3270 (Linux/MacOSX). You can change this by setting visible=False. Then test cases are run using ws3720 (Windows) or s3270 (Linux/MacOS). This is useful when test cases are run in a CI/CD-pipeline and there is no need for a graphical user interface.

Timeout, waits and screenshot folder are set on library import as shown above. However, they can be changed during runtime. To modify the wait_time, see Change Wait Time, to modify the img_folder, see Set Screenshot Folder, and to modify the timeout, see the Change Timeout keyword. Timeouts support all available Robot Framework time formats.

By default, Mainframe3270 will take a screenshot on failure. You can overwrite this to run any other keyword by setting the run_on_failure_keyword option. If you pass None to this argument, no keyword will be run. To change the run_on_failure_keyword during runtime, see Register Run On Failure Keyword.