Code-based development mode
This document describes the code-based development process. For more information, see Overview.
1. Create a project in code-based development mode
When you create a new project in the editor, select the Basic Code Project Template to create a project in code-based development mode. For more information about project development modes and saving methods, see Cloud and local projects.
2. Development interface
The code-based development interface consists of five main areas: the menu and shortcut buttons, the pane on the left (Components and Project), the central flow code editor, the control management pane on the right, and the bottom pane (Logs, Data View, and Parameters).

Menu. Includes the following:
File: Create, open, save, and close projects. The Exit button closes the editor.
View: Show or hide panes. If you close a pane in the editor, you can reopen it from this menu.
Project: Manage custom software development kits (SDKs) and third-party libraries in Component Management. You can import enterprise-specific SDKs or third-party libraries into the project. The Publish feature lets you publish the project as an application to the enterprise marketplace.
Design: Activate the control capture tool.
Toolbar. Provides shortcut buttons for actions such as creating, opening, saving, and closing a project, capturing controls, selecting a flow to start debugging from, managing components, and publishing.
Components pane. Lists all available SDKs in a tree structure by purpose. When you select an SDK, its code hinting information appears below.
Project pane: Manages the project structure. You can right-click to rename the project, open the project folder, create new folders to organize flows, and create new automation flows.
Flow code editor. A built-in Python Integrated Development Environment (IDE) for writing Python code. The editor supports code hinting, which automatically displays available methods when you reference SDK components. You can set breakpoints in the line number area for flow debugging. Hover over a component to view its parameter details and usage instructions.
Controls pane. Supports multiple ways to capture controls and provides a grouping feature. You can right-click a control to copy its name, edit it, or delete it. Use the settings button to select operations such as click and input.
Logs pane. Displays logs generated during flow execution, such as system logs, operation logs, and debug logs.
Data View. Supports writing data from an automated collection to a structured view in real time. It also lets you seamlessly import data from and export data to Excel for easy validation, analysis, and subsequent processing.
Parameters pane. Defines the input parameters for the current flow.
3. Project structure
A code-based project contains three types of items:
Flows: Main flow and child flows.
main is the main flow. After you publish the project as an application, the entry point for calls is the start() method of the main flow.
Right-click in the Project pane to create a child flow. You can also create multi-level folders.
Flows can call each other.
References: Stores referenced third-party libraries and custom components.
These references are managed using the Component Management feature.
Resources: Stores resource files needed at runtime, such as Excel files.
4. Basic syntax
The code-based development mode must be compatible with the Python version displayed in the bottom-right corner of the editor.
Common syntax
Function definition: Use
defto create reusable functions and improve code organization.Module import: Use
importto include standard libraries or third-party modules.Flow control:
for/whileloops andif/elif/elseconditional statements.Exception handling: Use the
try/exceptstructure to catch and handle runtime errors.String operations: Use
"{}".format()to insert dynamic content, and usesplit()/join()to process text.
Common modules
Module |
Purpose |
Example scenario |
|
File system and process operations |
Directory traversal, environment variable management |
|
Date and time processing |
Timestamp calculation, formatted output |
|
Data serialization |
API response parsing, configuration file processing |
|
Regular expression |
Text pattern matching, data cleaning |
|
HTTP requests |
API calls |
|
Data processing |
Tabular data operations, numerical calculations |
Variable naming suggestions
Use semantic naming. For example, order_total is better than ot. Use the is_ or has_ prefix for Boolean values, such as is_valid. Avoid single-letter variables, except for loop counters such as i. Follow the variable naming conventions to ensure code readability and efficient team collaboration.
5. Capture controls
A "control" is the basic object that a Robotic Process Automation (RPA) bot uses to simulate human interaction for interface automation. It represents various interface elements that are used when an application (flow) is executed. For example, an input box, a search button, a page title on a webpage, and a logon button on a client can all be considered controls. For more information, see Capture and use controls.
6. Use SDKs
More than 700 built-in automated Python methods are available. The common categories are listed in the following table:
Category |
Purpose |
Reference location |
Related automation methods |
Win32 |
Operate on window objects |
rpa.ui.win32 |
|
Java |
Operate on Java objects |
rpa.ui.java |
|
IE |
Operate on the IE browser |
rpa.app.ie |
|
Chrome |
Operate on the Chrome browser |
rpa.app.chrome |
|
Edge |
Operate on the Edge browser |
rpa.app.edge |
|
SE360 |
Operate on the 360 browser |
rpa.app.se360 |
|
SAP |
Operate on the SAP client |
rpa.app.sap |
|
Microsoft/WPS |
Operate on Excel |
rpa.app.microsoft rpa.app.wps |
|
CV |
Operate on controls recorded by CV |
rpa.ai.cv |
|
LLM |
Call Large Language Model (LLM) interfaces based on the OpenAI SDK |
rpa.ai.llm |
|
AliyunOCR |
Use Alibaba Cloud OCR |
rpa.ai.aliyun_ocr |
|
Asset |
Operate on asset variables |
rpa.console.asset |
|
Logger |
Record logs |
rpa.console.logger |
|
Workbench |
Set the task result |
rpa.console.workbench |
|
Param |
Operation Parameters |
rpa.project.params |
|
Datatable |
Operate on the Data View |
rpa.project.datatable |
|
Resource |
Operate on the project's resource folder |
rpa.project.resource |
|
No Disturb Mode |
Set No Disturb Mode |
rpa.system.no_disturb_mode |
|
Screen Unlocker |
Unlock the screen |
rpa.system.screen_unlocker |
|
Dialog |
Set up a dialog box |
rpa.system.dialog |
7. Extension methods
The editor has a built-in Python runtime environment. You can learn how to view the built-in third-party Python libraries of the engine.
If the built-in third-party libraries do not meet your needs, you can learn how to reference third-party Python libraries.
During flow development, developers can extract common operations into custom components for reuse across different automation flows. You can learn how to develop and use custom components.
8. Local debugging in the editor
Record logs. For more information, see Logger.
Debug a specific flow method. In the toolbar, select a method in a flow to start debugging from that method.
Breakpoint debugging. After setting a breakpoint, you can pause, step over, step into, step out, or stop during debugging, as shown in the following figure.
9. Publish
After you develop and debug a project locally, you must publish it as an application before it can be used by multiple bots. For more information, see Publish and manage applications.
10. Iterative development
To ensure that the iterative development and testing process does not affect production applications, see Test applications and publish them online.