An RPA system and method that simulates user behavior to maintain login status
By introducing a session maintenance module and distributed machine clusters into the RPA system, the problem of RPA programs frequently logging in on secure websites was solved, achieving more efficient automated operations and reducing costs.
Patent Information
- Application Number
- CN202210275029.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2042-03-21
AI Technical Summary
Existing RPA programs frequently use SMS verification on websites with higher security levels, resulting in time-consuming and inefficient login authentication and an inability to effectively utilize the cookie-free login mechanism.
By introducing a session maintenance module into the RPA system, saving user cookies to the database and periodically executing maintenance tasks in a distributed machine cluster, user behavior is simulated to extend the validity period of cookies and avoid frequent logins.
It reduces the frequency of login authentication, shortens the running time of RPA programs, improves execution efficiency, and reduces costs incurred due to SMS verification, etc.
Smart Images

Figure CN114860394B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an RPA system and method for simulating user behavior to maintain a logged-in state, belonging to the fields of network security and software process automation. Background Art
[0002] RPA, or Robotic Process Automation, refers to the use of software to automate tasks previously performed manually by computers across various industries. It enables software robots to automatically handle numerous repetitive, rule-based workflow tasks, such as online office work, report entry, and operating system software. RPA robots can complete these tasks accurately and quickly, reducing human errors, improving efficiency, and significantly lowering operating costs. Leveraging advanced software automation technology, RPA significantly reduces development costs and cycles, enabling enterprise office automation, improving productivity, and reducing costs.
[0003] like Figure 1 As shown in the figure, a common business scenario involves using an RPA robot to control a browser. Users must enter their account number and SMS verification code to log in to the website before they can conduct business. Typically, after an account logs in to a website for the first time, the browser saves a file containing login authentication information locally, known as a cookie, and the server saves session information, known as a session. Both files are long strings of characters encoded using different algorithms and have expiration dates. When logging in to the website again, the browser uses the existing cookie. As long as both the cookie and session are valid and match, login-free login is achieved.
[0004] Some high-security websites, such as those for banks, finance, taxation, and social security, operate with high confidentiality and high risk, so special measures are implemented to enhance security. A common mechanism is to invalidate logins after a few minutes of inactivity, requiring a new login. This works because the JavaScript program on the page records user actions (such as button clicks and text input). If the user does not perform any activity for T minutes (for example, 2 minutes), the server-side session is deleted, even if it has not yet expired, invalidating the client login. Frequent SMS verification increases the time required for RPA program login authentication, resulting in longer runtimes and lowered efficiency. Summary of the Invention
[0005] Purpose of the invention: In response to the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide an RPA system and method that simulates user behavior to maintain a logged-in state, so as to avoid frequent login authentication and improve execution efficiency.
[0006] Technical solution: To achieve the above-mentioned purpose, the present invention adopts the following technical solution:
[0007] An RPA system that simulates user behavior to maintain a logged-in state includes an RPA main program module and a session maintenance module. The RPA main program module is configured to, upon receiving an RPA task, call the session maintenance module through a query interface based on an authentication identifier to obtain a local authentication record cookie corresponding to the authentication identifier. If the cookie is obtained, the cookie is loaded and the task is executed on the target website specified by the task. If the cookie cannot be obtained or the cookie loading fails, the target website is logged in based on the authentication identifier. After successful authentication, the session maintenance module is called through an add interface to save the cookie record, and a maintenance task is created by calling the session maintenance module through a create maintenance task interface.
[0008] The session maintenance module is used to query, add, and delete cookie records based on calls to the RPA main program module; as well as to create and schedule maintenance tasks. When a maintenance task is created, a maintenance task record is added to the database, and the record fields include authentication identifier, target website URL, Action, Cookie, and last maintenance time. The Action is a script code that can be executed in a browser. The scheduling of the maintenance task is to add a scheduled task for session maintenance when creating the maintenance task. The scheduled task is maintained by the scheduler. When the preset time is reached, an idle machine in the distributed machine cluster is selected to execute the session maintenance task.
[0009] Preferably, both RPA tasks and session maintenance tasks use a distributed machine cluster as a consumer, and the machines in the cluster are deployed with task receiving programs and RPA main program modules.
[0010] Preferably, the data content of the RPA task includes authentication identification, task type, target website URL and business data; the session maintenance task is a type of RPA task, which is identified as a session maintenance task by the task type, and the action of maintaining the session is specified in the task data.
[0011] Preferably, the RPA task data also includes a region field, so that when scheduling session maintenance tasks, idle machines in a specified region of the distributed machine cluster are preferentially selected.
[0012] Preferably, when the RPA main program module loads the cookie to log in, if the authentication fails, the session maintenance module is called through the deletion interface to delete the authentication data.
[0013] In specific applications, the authentication method of the target website can be SMS authentication or email authentication, and the authentication identifier in the task data is a mobile phone number or email address.
[0014] Preferably, the RPA main program module configures whether to use the session maintenance module through a configuration file.
[0015] An RPA method for simulating user behavior to maintain a logged-in state includes the following steps:
[0016] When the RPA main program module receives an RPA task, it calls the session maintenance module through the query interface based on the authentication identifier to obtain the local authentication record cookie corresponding to the authentication identifier. If the cookie is obtained, it loads the cookie and enters the target website specified by the task to execute the task. If the cookie cannot be obtained or the cookie loading login fails, it logs in to the target website based on the authentication identifier. After successful authentication, it calls the session maintenance module through the addition interface to save the cookie record, and calls the session maintenance module through the create maintenance task interface to create a maintenance task.
[0017] When the session maintenance module creates a maintenance task, it adds a maintenance task record to the database and adds a scheduled task for session maintenance. The fields of the record include authentication identifier, target website URL, Action, Cookie and last maintenance time; the Action is a script code that can be executed in the browser;
[0018] The scheduler of the session maintenance module maintains the scheduled task. When the preset time is reached, an idle machine is selected in the distributed machine cluster to perform the session maintenance task.
[0019] As a preferred method, after receiving the session maintenance task, the machine in the distributed machine cluster calls the RPA main program module to execute the session maintenance task, opens the target website URL through the browser, calls the session maintenance module interface through the query interface to obtain and load the cookie, executes the Action script code on the page, and judges the execution result. If successful, the task result is returned to the scheduler, and the scheduler waits for the preset time to issue the session maintenance task again, forming a loop; if it fails, the session maintenance module is called through the deletion interface to delete the authentication data.
[0020] Beneficial Effects: This invention saves the user's local authentication record cookie in a database. By setting up a session maintenance module, it schedules the session maintenance task as a new type of RPA task in a distributed machine cluster. By executing the session maintenance task, it can simulate the user's browser operation behavior, cyclically triggering the Action script action, and avoid judging the user as unresponsive, thereby maximizing the cookie's effective duration and fully utilizing the cookie login-free mechanism. Compared with the existing technology, this invention can reduce the frequency of login authentication, shorten the PRA program running time, improve efficiency, and reduce the financial costs incurred by SMS verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 This is a workflow diagram of the existing RPA system.
[0022] Figure 2 This is a workflow diagram of the RPA system in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and specific embodiments.
[0024] An embodiment of the present invention discloses an RPA system that simulates user behavior to maintain a login state, mainly including an RPA main program module and a session maintenance module. The RPA main program module adds cookies and maintenance-related processing logic to the original program, and is used to, when receiving an RPA task, call the session maintenance module through a query interface based on the authentication identifier to obtain the local authentication record cookie corresponding to the authentication identifier. If the cookie is obtained, the cookie is loaded and the target website specified by the task is entered to perform the task; if the cookie cannot be obtained or the login fails to load the cookie, the target website is logged in according to the authentication identifier, and after successful authentication, the session maintenance module is called through an added interface to save the cookie record, and the session maintenance module is called through a create maintenance task interface to create a maintenance task.
[0025] The newly added session maintenance module is used to query, add, and delete cookie records based on calls from the RPA main program module; as well as to create and schedule maintenance tasks. When creating a maintenance task, a maintenance task record is added to the database. The record fields include authentication identifier, target website URL, Action, Cookie, and last maintenance time. The scheduling of the maintenance task is to add a scheduled task for session maintenance when creating the maintenance task. The scheduler maintains the scheduled task and selects an idle machine in the distributed machine cluster to execute the session maintenance task when the preset time is reached.
[0026] like Figure 2 The architecture is divided into three layers: the RPA main program module, the interface layer, and the session maintenance module. Each layer uses HTTP requests for communication, offering advantages such as low coupling, high scalability, and pluggability.
[0027] The RPA main program module has been modified and optimized based on the original login authentication (such as SMS verification login, email verification login, etc.). Cookie login maintained by this system is preferred.
[0028] The RPA main program module and the session maintenance module can run and be deployed independently, communicating with each other through the interface layer. The RPA main program loads a configuration file to start up. By modifying the configuration file, you can control whether to use the session maintenance module. If not, the RPA program will run as a traditional program without affecting the main business operations.
[0029] The database, serving as the data persistence mechanism for the session maintenance module, is deployed on the same local area network as the module, ensuring greater security for intranet communication. The fields in the session maintenance module's data table include: id (primary key), phone number (using SMS authentication as an example), URL (website address), action (script code that can be executed in the browser), cookie (local authentication record), and update_time (last maintenance time).
[0030] The interface layer, as an intermediate layer, serves as the entry point for operating the database and maintaining the task pool. This layer exposes common interfaces for the functional layer to call. The core of the session maintenance module is the scheduler, which is responsible for creating scheduled tasks. It polls and scans the distributed machine cluster, dispatching session maintenance tasks to idle machines. Computers and cloud servers distributed across China together form a distributed machine cluster. Any machine with the task receiving program and the RPA main program module installed and running can connect to the cluster and become a worker.
[0031] Both RPA tasks and session maintenance tasks use distributed machine clusters as consumers. Session maintenance tasks are essentially RPA tasks, with the same data structure as RPA tasks, and can be received and executed by distributed machine clusters. However, they differ in that they are single-task tasks: they complete the task after simulating the specified action.
[0032] The data of RPA tasks can be in JSON format, which includes the login phone number PhoneNumber, task type task, website URL, and business data data. For example:
[0033] {"PhoneNumber":"18811112222",
[0034] "URL":"https: / / www.simple.cn / ",
[0035] "task":"FillingEnterpriseIncomeTax",
[0036] "area":"shaanxi",
[0037] "data":"..."}
[0038] The data format for session maintenance tasks is also JSON. The task receiver passes the task to the RPA main program for execution. The RPA main program determines that this is a session maintenance task based on the task. Unlike RPA tasks, this task specifies the action for maintaining the session. For example:
[0039] {"PhoneNumber":"18811112222",
[0040] "URL":"https: / / www.simple.cn / ",
[0041] "area":"shaanxi",
[0042] "task":"KeepLogIn",
[0043] "Action":"driver.execute_js('$(\'#refresh\').click()')"}
[0044] The action in this example is to click the refresh button. The area in the task data is used to identify the area. When scheduling tasks, workers within the area are given priority to complete the task.
[0045] Figure 2 The following diagram illustrates the operation process of an RPA system with session maintenance functionality:
[0046] 1. Start the session maintenance module, read the authentication data from the database, and initialize it to load it into the session maintenance task pool.
[0047] 2. The cloud dispatches RPA tasks, and based on the area field in the task data body, it determines which machine worker is assigned to the corresponding area in the distributed cluster. The configuration files of the cluster machines all enable session persistence.
[0048] 3. The worker receives the RPA task and runs the RPA main program module to begin processing the target business task. The main program calls the browser driver to open the browser on the worker and redirects the URL to the target website. Based on the phone number, the session maintenance module's API query interface attempts to retrieve the corresponding cookie. If the cookie is retrieved, the module loads the cookie, refreshes the page, and attempts authentication-free login, proceeding to step 4. If the cookie is not retrieved, the module uses standard SMS authentication to log in.
[0049] 4. Using cookies stored in the maintenance module database doesn't guarantee successful authentication. If you can't open a page using a maintained cookie, it means the cookie has expired within the maintenance interval T. Call the session maintenance module's delete interface to delete the invalid authentication data and log in using regular SMS authentication.
[0050] 5. If the cookie is loaded and the login is successful, the RPA task is executed directly and the result is returned to the cloud, completing the task.
[0051] 6. For SMS authentication login, first call the add API to create a record in the session maintenance data table. Then call the create maintenance task API to add a scheduled task for session maintenance to the maintenance task scheduler. The scheduled task is issued at the current time + T. Finally, the task is completed after processing. The scheduled task tells the scheduler to issue the session maintenance task at the specified time.
[0052] 7. The maintenance task scheduler is responsible for maintaining scheduled tasks. The scheduled tasks are to wait for the preset time to arrive and search for an idle machine worker in the cluster according to the area, and send the specific maintenance tasks to the worker.
[0053] 8. The task receiving program on the machine parses the task and calls the RPA main program to perform the session maintenance task. The browser opens the URL page, calls the interface to obtain the cookie, loads the cookie, refreshes the page, executes the action script code on the page, and determines the execution result. If the execution is successful, the task is returned to the scheduler, and the maintenance program is issued again after T minutes, forming a loop. If the task fails, the session maintenance module's deletion interface is called to delete the authentication data.
Claims
1. An RPA system that simulates user behavior to maintain a logged-in state, characterized in that: Includes RPA main program module and session maintenance module; The RPA main program module is used to, upon receiving an RPA task, call the session maintenance module through the query interface according to the authentication identifier to obtain the local authentication record cookie corresponding to the authentication identifier; if the cookie is obtained, load the cookie and enter the target website specified by the task to execute the task; if the cookie cannot be obtained or the cookie loading login fails, log in to the target website according to the authentication identifier, and after successful authentication, call the session maintenance module through the addition interface to save the cookie record, and call the session maintenance module through the creation maintenance task interface to create a maintenance task; The session maintenance module is used to query, add, and delete cookie records based on calls from the RPA main program module; as well as to create and schedule maintenance tasks. When a maintenance task is created, a maintenance task record is added to the database. The record fields include the authentication identifier, target website URL, Action, Cookie, and last maintenance time. The Action is a script code that can be executed in the browser. The scheduling of the maintenance task is to add a scheduled task for session maintenance when the maintenance task is created. The scheduled task is maintained by the scheduler. When the preset time is reached, an idle machine in the distributed machine cluster is selected to execute the session maintenance task. Both RPA tasks and session maintenance tasks use a distributed machine cluster as a consumer. The machines in the cluster are deployed with the task receiving program and the RPA main program module. The data content of an RPA task includes the region, authentication identifier, task type, target website URL, and business data. A session maintenance task is a type of RPA task, identified as a session maintenance task by the task type, and the action for maintaining the session is specified in the task data. When scheduling a session maintenance task, idle machines in the specified region of the distributed machine cluster are prioritized.
2. The RPA system for simulating user behavior and maintaining a logged-in state according to claim 1 is characterized in that: When the RPA main program module loads the cookie to log in, if the authentication fails, the session maintenance module is called through the deletion interface to delete the authentication data.
3. The RPA system for simulating user behavior and maintaining a logged-in state according to claim 1, characterized in that: The authentication method of the target website is SMS authentication or email authentication, and the authentication identifier in the task data is a mobile phone number or email address.
4. The RPA system for simulating user behavior and maintaining a logged-in state according to claim 1, characterized in that: The RPA main program module configures whether to use the session maintenance module through a configuration file.
5. An RPA method for simulating user behavior to maintain a logged-in state, characterized in that: The steps include: When the RPA main program module receives an RPA task, it calls the session maintenance module through the query interface based on the authentication identifier to obtain the local authentication record cookie corresponding to the authentication identifier. If the cookie is obtained, it loads the cookie and enters the target website specified by the task to execute the task. If the cookie cannot be obtained or the cookie loading login fails, it logs in to the target website based on the authentication identifier. After successful authentication, it calls the session maintenance module through the addition interface to save the cookie record, and calls the session maintenance module through the create maintenance task interface to create a maintenance task. When the session maintenance module creates a maintenance task, it adds a maintenance task record to the database and adds a scheduled task for session maintenance. The fields of the record include authentication identifier, target website URL, Action, Cookie and last maintenance time; the Action is a script code that can be executed in the browser; The scheduler of the session maintenance module maintains scheduled tasks. When the preset time is reached, an idle machine in the distributed machine cluster is selected to perform the session maintenance task. Both RPA tasks and session maintenance tasks use a distributed machine cluster as a consumer. The machines in the cluster are deployed with the task receiving program and the RPA main program module. The data content of an RPA task includes the region, authentication identifier, task type, target website URL, and business data. A session maintenance task is a type of RPA task, identified by the task type as a session maintenance task, and the action to maintain the session is specified in the task data. When scheduling session maintenance tasks, idle machines are preferentially selected in the specified area of the distributed machine cluster.
6. The RPA method for simulating user behavior to maintain a logged-in state according to claim 5, characterized in that: After receiving the session maintenance task, a machine in the distributed machine cluster calls the RPA main program module to execute the task. It then opens the target website URL through a browser, calls the session maintenance module interface through the query interface to obtain and load cookies, executes the Action script code on the page, and determines the execution result. If successful, the task result is returned to the scheduler. The scheduler then waits for a preset time to issue the session maintenance task again, forming a loop. If it fails, the session maintenance module is called through the deletion interface to delete the authentication data.
Citation Information
Patent Citations
Single sign-on method and device based on Redis
CN111343145A
Multi-system single sign-on method and device based on RPA, equipment and medium
CN113660229A
Systems and methods for consistent enforcement policy across different saas applications via embedded browser
US20200099753A1