Automation processes often require fast and accurate data entry. Alibaba Cloud RPA provides a variety of atomic actions to automate these tasks. This article describes common methods for entering data in browsers and desktop client applications and helps you choose the right method for your scenario.
Browser automation
This section uses Google Chrome as an example. For other browsers, see the SDK documentation for the coding development mode or the component help documents for the visual development mode.
Input text
Coding development mode
Client version >= 4.10.3.1033
We recommend using input_text_simulated, which meets most requirements.
If you require a faster input speed, you can try the following two methods:
Method 1: input_text_directed. This method's effectiveness depends on the target web page's technical implementation. Test this method to ensure it works in your use case.
Method 2: Use the system clipboard for input. This method has specific requirements for the robot's runtime environment.
Earlier client versions
Use input_text.
For faster input, you can use the system clipboard for input. This method has specific requirements for the robot's runtime environment.
Visual development mode
Start with the Fill in Input Field (Web) component, which meets most requirements.
As an alternative, use the system clipboard for input. This method has specific requirements for the robot's runtime environment.
Password input
Password input fields on web pages generally fall into two categories:
HTML password fields, such as the one on the Alibaba Cloud login page.
See the Input Text section.
To handle passwords securely, you can use an asset variable.
For security controls, which are common on online banking login pages, see the Desktop Application Automation section.
Use hotkeys
To use a hotkey on a web page, such as pressing Enter to submit after typing in a search box, see Usage of input_hotkey and virtual key codes.
To interact with the browser application itself, such as using a feature in Chrome's developer tools, you must treat Chrome as a desktop application window. For more information, see Use Hotkeys.
Desktop application automation
This section uses Windows applications as an example.
Input text
Use input_text.
For faster input, you can use the system clipboard for input. This method has specific requirements for the robot's runtime environment.
Password input
You must use the drive_input method to enter passwords in secure fields.
Coding development mode
Visual development mode
The
drive_inputmethod is not directly supported. You must use it with the Call Custom Script component.
To use the drive_input method, you must run the Alibaba Cloud RPA client as an administrator.
The following example shows how to automatically enter a password into a secure password field on an online banking website.

Coding mode
from rpa.core import *
from rpa.utils import *
import rpa4 as rpa
def start():
# Find the online banking login window by its title
wnd = rpa.ui.win32.catch('Your online banking login window name', mode='title', pattern='equal')
# Enter the password into the password input field
wnd.drive_input("password_input_field", "1234abcd")Visual mode

The content of the Call Custom Script component is as follows:
v_win_obj_1.drive_input("password_input_field", "1234abcd")Use hotkeys
In desktop application automation, hotkeys are commonly used in two scenarios:
Use hotkeys to simplify the input process, such as by pressing Enter to submit after filling a text field. For an example, see Use CV mode to send messages in DingTalk.
Another scenario is when operations cannot be automated by targeting controls (for example, specific menu items). If the application supports a hotkey for the action, using the hotkey is the recommended approach. For an example, see Use hotkeys to operate software.
Alibaba Cloud RPA provides two methods for sending hotkeys to desktop applications: input_hotkey and send_key. The following table compares these methods and provides usage recommendations.
Method | Behavior | Use cases |
input_hotkey | Simulates key presses |
|
send_key |
|
System clipboard input
Use cases
Use this method for fast data entry. It is typically more than twice as fast as methods like
input_textordrive_input.When a previous step in the automation process copies data from the target interface (for example, by clicking a "Copy" button), a subsequent step can paste it using the Ctrl+V hotkey.
Limitations
Mechanism: This method works by emulating the standard Windows copy (Ctrl+C) and paste (Ctrl+V) functions.
Important
WarningBecause this method relies on the system clipboard, it can conflict with copy operations performed by a human user or another application on the same machine. For example, if an automation process is designed to enter "123", but a user presses Ctrl+C to copy "456" before the paste action executes, the automation process will incorrectly paste "456".
We do not recommend using this method in scenarios with human intervention, such as when an attended robot is run manually from the client.
When using this method with an unattended robot, you must disable the clipboard in the Elastic Desktop Service policy (see Standardizing the robot runtime environment). This prevents interference between the user's local clipboard and the robot's clipboard, which can occur when a user connects with the Elastic Desktop Service client.
Usage
Browser automation
Coding mode
This example automates Google Chrome.
from rpa.core import * from rpa.utils import * import rpa4 as rpa # Use the V4 engine import pyperclip # This Python library is built into the RPA client def start(): page = rpa.app.chrome.create("URL of the target web page") text_content = "abc123" # 'input' is the control name of a text input field on the page. # To overwrite the content, first clear the input field. # If the client version is <4.10.3.1033, use page.clear_input("input"). page.clear_input_simulated("input") # Copy the content to be entered into the system clipboard. pyperclip.copy(text_content) # Use the hotkey Ctrl+V to paste the clipboard content into the text field. page.input_hotkeys("input", "VK_CONTROL|V")Visual mode
You can use the following components:
Visual component
Usage
Mechanism
Recommended as the first choice.
Enters content into the text area of a specified control.
Performs a combined copy (Ctrl+C) and paste (Ctrl+V) operation.
Pastes content into the text area of a specified control.
Requires a previous step in the automation process to perform a copy (Ctrl+C) operation.
Performs only a paste (Ctrl+V) operation.
Pastes content at the current cursor position. This component does not depend on a control.
Requires a previous step to perform a copy (Ctrl+C) operation and to position the cursor (for example, by using Click Mouse).
Performs only a paste (Ctrl+V) operation.
Desktop application
Coding mode
This example automates Notepad in Windows.
from rpa.core import * from rpa.utils import * import rpa4 as rpa # Use the V4 engine import pyperclip # This Python library is built into the RPA client def start(): # Catches the Notepad window by a substring in its title. wnd = rpa.ui.win32.catch("Notepad", mode="substr") # Activates the window to bring it to the foreground. wnd.activate() text_content = "abc123" # Copy the content to be entered into the system clipboard. pyperclip.copy(text_content) # 'notepad-input' is the captured control for the Notepad input area. # Use the hotkey Ctrl+V to paste the clipboard content into the input area. wnd.input_hotkeys("notepad-input", "VK_CONTROL|v")Visual mode
You can use the following components:
Visual component
Usage
Mechanism
Recommended as the first choice.
Enters content into the text area of a specified control.
Performs a combined copy (Ctrl+C) and paste (Ctrl+V) operation.
Pastes content into the text area of a specified control.
Requires a previous step in the automation process to perform a copy (Ctrl+C) operation.
Performs only a paste (Ctrl+V) operation.
Pastes content at the current cursor position. This component does not depend on a control.
Requires a previous step to perform a copy (Ctrl+C) operation and to position the cursor (for example, by using Click Mouse).
Performs only a paste (Ctrl+V) operation.