Using Python
This topic provides guidelines for Python-based testing. You can write GUI tests in Python, while continuing to use other capabilities as you did before.
Overview
You can automate tests with Python, alongside VBScript. When you create a new GUI test, select the programming language in which you want to write the test. The processes for editing and running tests are the same for both languages.
To write effective Python tests, you need to be familiar with Python. If you are new to Python and would like to learn more, see the official Python documentation.
Note:
In version 26.1, Python-based testing is offered as a Beta feature and is installed as a separate Python Functional Testing Python Engine application.
In versions 26.3 and later, Python-based testing is fully supported and the FT Python Engine is available as a feature in the installation program.
Python installation prerequisite
Python-based testing is provided by the Functional Testing Python Engine.
Installing the Functional Testing Python Engine requires a supported 32-bit version of Python to be installed on your machine. For details on the supported Python versions, see Support Matrix.
The FT Python Engine installation links the engine to your Python installation by adding files under the Python installation folder. If you have multiple Python versions installed when you install the FT Python Engine, the engine is linked to the latest supported 32-bit version that is installed. If you want to use a specific version, make sure that only that version is downloaded and available on your system before starting the installation.
The Functional Testing Python Engine is installed differently in version 26.1 and 26.3, as described below.
| Version | Installation behavior |
|---|---|
|
26.3 and later |
The FT Python Engine is available as a feature on the Custom setup screen in the OpenText Functional Testing installation wizard. By default, this feature is included in the installation. For details, see Custom Setup screen. The silent installation also provides an ADDLOCAL option to include the FT Python Engine feature in the installation. For details, see Silent installation. If you previously installed the standalone Functional Testing Python Engine application from version 26.1, uninstall it before installing version 26.3. |
|
26.1 |
The Functional Testing Python Engine is provided as a standalone application alongside OpenText Functional Testing. If you have a supported 32-bit version of Python on your machine before installing OpenText Functional Testing from the setup.exe file, the Functional Testing Python Engine is installed automatically. Otherwise, you can install it manually after installing Python, by running the Note: When you run only the .msi program that installs OpenText Functional Testing, the Functional Testing Python Engine is not installed. For details on running the installation setup.exe, see Installation wizard. |
Upgrading Python
If you upgrade your Python version after installing the Functional Testing Python Engine, the engine remains linked with the previous version. If you want the engine to use the new Python version, or if you uninstalled the previous Python version, you must uninstall the Python Engine and install it again.
Note: this is relevant only if you are upgrading Python to a new major version (for example, from 3.11.x to 3.12.x).
To uninstall and reinstall the FT Python Engine:
The Functional Testing Python Engine is installed differently in version 26.1 and 26.3, as described below.
| Version | Uninstall and reinstall behavior |
|---|---|
|
26.3 and later |
To uninstall the Functional Testing Python Engine, run the OpenText Functional Testing installation program using the Change or Modify option, and deselect the FT Python Engine feature on the Custom Setup screen. To install it again, repeat this process, this time selecting the FT Python Engine feature. |
|
26.1 |
Uninstall the standalone Functional Testing Python Engine application and then install it again. |
Create and run Python tests
When you create a new GUI test, select Python as the programming language.
Next, you can write your test in Python in the editor, or use built-in features to create and edit steps. For example, the Object Spy, Object Identification Center, Step Generator, Test Recorder, and Object Repository Window and Manager are all supported for working in Python.
Python tests, function libraries and recovery scenarios use dedicated file extensions (.py, .pfl, and .prs respectively). Python tests use only Python function libraries and recovery scenarios.
For details on using test objects, methods, and properties in your tests, see the Object Model Reference.
The examples are mostly in VBScript. When programming in Python:
- You can replace VBScript programming statements with Python ones, using the official Python documentation for syntax and guidelines.
- For Object Model steps, use the demonstrated syntax, but make sure all method calls enclose the arguments in parentheses '()'. Use empty parentheses '()' when calling a method with no arguments.
Run Python GUI tests as you would run VBScript GUI tests.
Best practices when writing tests in Python
This section provides some programming guidelines to keep in mind when writing tests in Python.
Using methods from Python packages
Make sure you do not call blocking functions such as subprocess.run or getpass. These functions take the control away from your test and may not return.
Similarly, make sure not to call functions that wait for terminal input, as the input terminal is not supported and the test becomes unresponsive.
Interactive input methods
Your tests run in a non-interactive environment, which does not provide an interface for input. Therefore, the following Python methods, which read values from standard input, are not supported:
- input()
- sys.stdin.read()
- sys.stdin.readline()
- sys.stdin.readlines()
- fileinput.input()
Rather than writing scripts that accept input interactively, provide information to your test in other ways, such as data table parameters.
If you do need to enter information interactively, you can program your test to display a dialog box that prompts the user for information and then continues running the test or component. You can use the value that was entered by the user later in the run session. Keep in mind that this may block your test from continuing until the input is provided.
To program such a dialog box, use the tkinter Python package. For details, see the official Python documentation. For an example, see How can I enter information during a run session?
Known issues with Python scripting
Writing tests in Python has the following known issues:
| Area | Known issue |
|---|---|
|
Unsupported features |
The following features are not supported:
|
| Error handling for run errors |
If a run error occurs during a Python test run (for example, an undefined variable or an unidentified test object), you cannot run the rest of the action. You can do one of the following:
|
| Visual Studio Just-In-Time (JIT) Debugger |
Issue: During a test run, when a Python script error or an internal exception occurs, the Visual Studio Just-In-Time (JIT) Debugger sometimes opens, interrupting the test run. Workaround: Disable JIT debugging in Visual Studio. |
Known issues in version 26.1
The following known issues are relevant for the Beta version of Python support provided in version 26.1.
-
The Python Engine is incompatible with other Python packages, such as pywin32.
-
Recovery scenarios are not supported.
-
Maintenance mode is not supported.
-
When running Python tests without inserting a breakpoint, test steps are not highlighted as the test runs.
-
After selecting Debug from Action and clicking Run, the test run pauses at the first statement. You must click Continue to proceed and highlight subsequent statements.
Pressing Step Over does not advance to the next action and the run stays paused until you click Continue.
-
The Edit > Code Snippet menu options for inserting conditional and loop statements are supported for VBScript only. For Python, enter the statements manually.

