Element selection method, system, terminal device and readable storage medium

Through the communication connection and element information processing between RPA applications and Java applications, the problem of obtaining Java element identifiers under Linux is solved, the Java automation infrastructure is realized, and the feasibility of Java automation technology in the Linux environment is ensured.

CN117667285BActive Publication Date: 2024-09-03NINETECH INFORMATION TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311656487.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-04
Publication Date
2024-09-03
Estimated Expiration
2043-12-04

AI Technical Summary

Technical Problem

Under the Linux operating system, there is a lack of a method to automatically obtain the element identifier of a Java element, making it impossible to implement Java automation.

Method used

Establish a communication connection with the Java application through the RPA application, obtain the mouse position and determine whether it is a Java application, receive the JavaID, obtain all Java element information under the mouse position, determine the target Java element, and generate an element identification based on the element information and parent node information.

Benefits of technology

It realizes the automatic acquisition of the element identification of Java elements under the Linux operating system, and solves the problem of implementing Java automation under Linux.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117667285B
    Figure CN117667285B
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology, and provides a method, system, terminal device and readable storage medium for selecting an element. In an embodiment of the present application, an RPA application establishes a communication connection with a Java application, obtains the mouse position, and sends the mouse position to a target Java application. According to the element information of all Java elements under the mouse position returned by the target Java application, the target element is determined, and the element information of the target Java element and the parent node element information are obtained, thereby obtaining the element identifier of the target Java element. By using an embodiment of the present application, the element identifier of a Java element can be automatically obtained under the Linux operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a method, system, terminal device and readable storage medium for selecting an element. Background Art

[0002] RPA (Robotic Process Automation) is a technology used to automate regular, highly repetitive workflows. RPA can simulate human operations on computers to automate various applications. In Java automation, RPA can be used to automate testing, building, and deployment, improve development efficiency, reduce human errors, and shorten development cycles. The basis for using RPA technology to achieve Java automation is to achieve automatic selection of Java elements, and achieving automatic selection of Java elements requires determining the element identifier of the target element (including coordinates and node level information).

[0003] In the related art, Java automation technology is generally implemented under the Microsoft Windows operating system, while under the Linux operating system, there is a lack of methods for automatically obtaining element identifiers of Java elements. Summary of the invention

[0004] The embodiments of the present application provide an element selection method, system, terminal device and readable storage medium, which can solve the problem in the related art that the element identification of a Java element cannot be automatically obtained under the Linux operating system.

[0005] In a first aspect, an embodiment of the present application provides a method for selecting an element, wherein the method for selecting an element is applied to an element selection system, wherein the system includes an RPA application and a Java application, and the method includes:

[0006] The RPA application establishes a communication connection with the Java application;

[0007] The RPA application obtains the mouse position, and determines whether the application corresponding to the mouse position is the Java application;

[0008] When the application corresponding to the mouse position is the Java application, the RPA application receives the JavaID of the corresponding target Java application, and sends the mouse position to the target Java application through the JavaID, and the target Java application is the Java application corresponding to the mouse position;

[0009] The target Java application receives the mouse position, obtains element information of all Java elements under the mouse position, and returns the element information of all Java elements to the RPA application;

[0010] The RPA application receives element information of all the Java elements, determines a target Java element based on the element information of all the Java elements, and sends a query request to the target Java application;

[0011] The target Java application queries the parent node element information of the target Java element based on the query request, and generates an element identifier of the target Java element according to the element information of the target Java element and the parent node element information;

[0012] The RPA application receives an element identifier of the target Java element.

[0013] In a second aspect, an embodiment of the present application provides an element selection system, the system comprising an RPA application and a Java application;

[0014] The RPA application is used to establish a communication connection with the Java application;

[0015] The RPA application is further used to obtain a mouse position and determine whether an application corresponding to the mouse position is the Java application;

[0016] When the application corresponding to the mouse position is the Java application, the RPA application is further used to receive the JavaID of the corresponding target Java application, and send the mouse position to the target Java application through the JavaID, and the target Java application is the Java application corresponding to the mouse position;

[0017] The target Java application is used to receive the mouse position, obtain element information of all Java elements under the mouse position, and return the element information of all Java elements to the RPA application;

[0018] The RPA application is further used to receive element information of all the Java elements, determine a target Java element based on the element information of all the Java elements, and send a query request to the target Java application;

[0019] The target Java application is further used to query the parent node element information of the target Java element based on the query request, and generate an element identifier of the target Java element according to the element information of the target Java element and the parent node element information;

[0020] The RPA application is further configured to receive an element identifier of the target Java element.

[0021] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned element selection method when executing the computer program.

[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned element selection method are implemented.

[0023] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the above-mentioned method for selecting elements.

[0024] Compared with the prior art, the beneficial effects of the embodiment of the present application are as follows: In the embodiment of the present application, the RPA application establishes a communication connection with the Java application, obtains the mouse position, and sends the mouse position to the target Java application. According to the element information of all Java elements under the mouse position returned by the target Java application, the target element is determined, and the element information of the target Java element and the parent node element information are obtained, thereby obtaining the element identifier of the target Java element. By adopting the embodiment of the present application, the element identifier of the Java element can be automatically obtained under the Linux operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0026] Figure 1 It is a schematic diagram of an implementation flow of a method for selecting an element provided in an embodiment of the present application;

[0027] Figure 2 It is a structural schematic diagram of an element selection system provided in an embodiment of the present application;

[0028] Figure 3 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are protected by the present application.

[0030] It should be noted that the terms "include", "comprises" and "have" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, terminal, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. In the claims, specification and drawings of the present application, relational terms such as "first" and "second" are merely used to distinguish one entity / operation / object from another entity / operation / object, and do not necessarily require or imply any such real-time relationship or order between these entities / operations / objects.

[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0032] RPA (Robotic Process Automation) is a technology used to automate regular, highly repetitive workflows. RPA can simulate human operations on computers to automate various applications. In Java automation, RPA can be used to automate testing, building, and deployment, improve development efficiency, reduce human errors, and shorten development cycles. The basis for using RPA technology to achieve Java automation is to achieve automatic selection of Java elements, and achieving automatic selection of Java elements requires determining the element identifier of the target element (including coordinates and node level information).

[0033] In the related art, Java automation technology is generally implemented under the Microsoft Windows operating system, while under the Linux operating system, there is a lack of methods for automatically obtaining element identifiers of Java elements.

[0034] In view of this, in the embodiment of the present application, the RPA application establishes a communication connection with the Java application, obtains the mouse position, and sends the mouse position to the target Java application. According to the element information of all Java elements under the mouse position returned by the target Java application, the target element is determined, and the element information of the target Java element and the parent node element information are obtained, thereby obtaining the element identifier of the target Java element. By adopting the embodiment of the present application, the element identifier of the Java element can be automatically obtained under the Linux operating system.

[0035] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0036] Figure 1 The present invention provides a schematic diagram of an implementation process of a method for selecting an element provided by an embodiment of the present invention, which can be applied to a terminal device. The terminal device can be a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, etc.

[0037] The above-mentioned element selection method can be applied to an element selection system, and the element selection system can include an RPA application and one or more Java applications.

[0038] Specifically, the above element selection method may include the following steps S101 to S107.

[0039] Step S101: The RPA application establishes a communication connection with the Java application.

[0040] In the implementation of the present application, before the RPA application interacts with the Java application, a communication connection between the RPA application and the Java application needs to be established. The RPA application can establish a communication connection with one or more Java applications.

[0041] Step S102: The RPA application obtains the mouse position and determines whether the application corresponding to the mouse position is a Java application.

[0042] The user can move the mouse to different positions on the interactive interface, for example, the mouse can be moved to a Java application or a non-Java application.

[0043] In the implementation of the present application, the RPA application can monitor mouse events, such as mouse movement, mouse click, etc. When a mouse movement event occurs, the RPA application can obtain the position information of the mouse, and determine whether the application corresponding to the mouse position is a Java application by obtaining the application name of the application corresponding to the mouse position according to the mouse position. The RPA application can also interact with the Java application, obtain the interaction result, and determine whether the application corresponding to the mouse position is a Java application according to the interaction result.

[0044] Step S103: When the application corresponding to the mouse position is a Java application, the RPA application receives the JavaID of the corresponding target Java application and sends the mouse position to the target Java application through the JavaID.

[0045] The target Java application is the Java application corresponding to the mouse position.

[0046] In an embodiment of the present application, when the RPA application determines that the application corresponding to the mouse position is a Java application, the target Java application can return the JavaID of the target Java application to the RPA application. The RPA application can send the mouse position to the target Java application through a communication connection based on the JavaID.

[0047] Step S104: The target Java application receives the mouse position, obtains element information of all Java elements under the mouse position, and returns the element information of all Java elements to the RPA application.

[0048] The element information can be used to describe the detailed information of each element in the Java class, such as name, role, description, depth, index, virtualname, rect, etc. It should be understood that in the window of a Java application, there may be multiple Java elements under the mouse position. For example, if multiple elements (such as buttons, text boxes, etc.) are placed in some windows, and these elements overlap or are adjacent, then at a specific mouse position, there may be multiple elements under the mouse.

[0049] In the implementation of the present application, after the target Java application receives the mouse position, it can obtain the element information of all elements under the mouse position by calling the method in AcessBridge.jar, and return the element information of all Java elements to the RPA application through the communication connection. Specifically, the BitWorkerJavaBridge.dll of the target Java application and AcessBridge.jar call each other through JNI technology. AcessBridge.jar runs in the JAVA virtual machine and can obtain the JAVA application running in the JAVA virtual machine, monitor JAVA events, and specific element information of Java elements.

[0050] Step S105: The RPA application receives element information of all Java elements, determines a target Java element based on the element information of all Java elements, and sends a query request to the target Java application.

[0051] The query request is used to instruct the target Java application to query the parent node element information of the target Java element.

[0052] In an implementation manner of the present application, after receiving the element information of all Java elements, the RPA application may determine the target Java element using a matching algorithm and send a query request to the target Java application.

[0053] In some specific implementations of the present application, the above-mentioned determination of the target Java element based on the element information of all Java elements may include the following steps:

[0054] The RPA application traverses all Java elements, obtains the rectangular area of ​​all Java elements, and determines the Java element with the smallest rectangular area as the target Java element.

[0055] Step S106: the target Java application queries the parent node element information of the target Java element based on the query request, and generates an element identifier of the target Java element according to the element information of the target Java element and the parent node element information.

[0056] The element identifier can be used to determine the location of the target element in the reverse element search step.

[0057] In an embodiment of the present application, after receiving a query request, the target Java application can query the parent node element information of the target Java element. Specifically, the target Java application searches for the parent node of the target Java element and records the element information of the parent node, then searches for the parent node of the parent node of the target Java element and records the element information of the parent node, and repeats this step until the window node is found and the element information of the window node is recorded. After obtaining the parent node element information of the target Java element, the target Java application combines the hierarchical relationship between the target Java element and each parent node, as well as its own element information and the parent node element information to obtain the element identifier.

[0058] Step S107: The RPA application receives the element identifier of the target Java element.

[0059] In an embodiment of the present application, after the target Java application generates an element identifier of the target Java element, it can return the element identifier of the target Java element to the RPA application through a communication connection, so that the RPA application obtains the element identifier of the target Java element.

[0060] Compared with the prior art, the beneficial effects of the embodiment of the present application are as follows: In the embodiment of the present application, the RPA application establishes a communication connection with the Java application, obtains the mouse position, and sends the mouse position to the target Java application. According to the element information of all Java elements under the mouse position returned by the target Java application, the target element is determined, and the element information of the target Java element and the parent node element information are obtained, thereby obtaining the element identifier of the target Java element. By adopting the embodiment of the present application, the element identifier of the Java element can be automatically obtained under the Linux operating system.

[0061] In some implementations of the present application, the RPA application establishes a communication connection with the Java application, which may specifically include steps S201 to S206.

[0062] Step S201: The RPA application loads BitWorkerBridge.dl, initializes BitWorkerBridge.dll, and generates an RPAID.

[0063] In the implementation of the present application, the RPA application can load a dynamic link library (DLL) named BitWorkerBridge.dll and initialize it. During the initialization process, the RPA application generates a unique identifier, namely RPAID. Specifically, the initialization process includes: creating a thread lock; registering the dbus bus; creating an independent thread to listen to dbus messages.

[0064] Step S202: The RPA application starts an independent thread to monitor dbus messages and broadcasts a first asynchronous message.

[0065] The content of the first asynchronous message includes the RPAID. dbus is a mechanism for inter-process communication.

[0066] In the implementation of the present application, the RPA application can start an independent thread to monitor the dbus message. The RPA application can also broadcast an asynchronous message, the content of which includes the RPAID generated previously. Specifically, the RPA application can specify the object, interface, and signal name, set the signal content (including the RPAID), and send the signal.

[0067] Step S203: After receiving the first asynchronous message, all Java applications return a second asynchronous message to the RPA application.

[0068] The content of the second asynchronous message includes the JavaID corresponding to each Java application.

[0069] In the implementation of the present application, when all Java applications receive the first asynchronous message sent by the RPA application, they will return a second asynchronous message to the RPA application. The content of this message includes the JavaID corresponding to each Java application. Specifically, all Java applications can read messages cyclically, receive asynchronous messages and process asynchronous messages.

[0070] Step S204: After receiving the second asynchronous message, the RPA application creates a shared memory with the Java application, uses the RPAID and the JavaID as identifiers of the shared memory, and sends a synchronous message to the Java application corresponding to the JavaID.

[0071] The content of the synchronization message includes an identifier.

[0072] In an embodiment of the present application, after the RPA application receives the second asynchronous message, it can create a shared memory with the Java application. The identifiers of this shared memory are RPAID and JavaID. Then, the RPA application can send a synchronous message to each Java application, and the content of this message includes the identifier. Specifically, the RPA application can specify the object, interface, signal name, set the signal content, send the message and wait for a reply.

[0073] It is understandable that by creating shared memory, messages can be communicated between processes. The DLLs in the RPA application and the Java application can access this shared memory together. This method has a fast communication speed and greatly reduces the memory consumption in the process of large-scale data processing. The specific steps of creating shared memory include: creating an extraction code, creating a shared space, and setting the shared space address.

[0074] Step S205: The Java application reads the identifier, obtains the shared memory, and writes a confirmation message into the shared memory.

[0075] The confirmation message is used to confirm that the Java application and the RPA application have successfully communicated, and the specific content may be OK.

[0076] In an embodiment of the present application, when the Java application receives a synchronization message sent by the RPA application, it can read the identifier in the message and obtain the shared memory accordingly. Then, the Java application can write a confirmation message to the shared memory.

[0077] Step S206: The RPA application reads the confirmation message of the shared memory and determines that a communication connection is successfully established with the Java application.

[0078] In an embodiment of the present application, the RPA application may read the confirmation message in the shared memory. If the confirmation message exists, the RPA application may confirm that the communication connection with the Java application has been successfully established.

[0079] The implementation manner of the present application establishes a communication connection between the RPA application and the Java application by creating a shared memory. The two communicate through the shared memory, which can improve the communication speed and greatly reduce the memory consumption during large-scale data processing.

[0080] In some specific implementations of the present application, the above method may further include steps S301 to S304.

[0081] Step S301: The RPA application creates a thread lock and sets the thread lock on the shared memory before writing a message to the shared memory.

[0082] Among them, thread lock is a synchronization mechanism that can be used to control access to shared resources.

[0083] In the implementation of the present application, the RPA application creates a thread lock. When the RPA application wants to write a message to the shared memory, it first adds a thread lock to the shared memory to prevent other threads from accessing the shared memory at the same time.

[0084] Step S302: The Java application creates a thread lock and sets the thread lock on the shared memory before reading the message in the shared memory.

[0085] In the implementation of the present application, similarly, the Java application also creates a thread lock, and adds a thread lock to the shared memory before reading the message in the shared memory, thereby ensuring that there is no interference from other threads when reading the shared memory.

[0086] Step S303: After writing the message to the shared memory, the Java application releases the thread lock of the shared memory.

[0087] In an implementation manner of the present application, after a Java application writes a message to a shared memory, it may release a thread lock on the shared memory to allow other threads to access the shared memory.

[0088] Step S304: After reading the message in the shared memory, the RPA application releases the thread lock of the shared memory.

[0089] In an embodiment of the present application, after the RPA application reads a message from the shared memory, it may also release the thread lock on the shared memory to allow other threads to access the shared memory.

[0090] In some specific implementations of the present application, before the RPA application establishes a communication connection with the Java application, the method may further include steps S401 to S403.

[0091] Step S401: The Java application loads AcessBridge.jar, and loads BitWorkerJavaBridge.dll through AcessBridge.jar.

[0092] Among them, AcessBridge.jar may contain some Java classes or libraries for interacting with BitWorkerJavaBridge.dll. BitWorkerJavaBridge.dll is a dynamic link library file, which may contain some local methods or resources.

[0093] In the implementation manner of the present application, the Java application may first load AcessBridge.jar, and then load BitWorkerJavaBridge.dll through AcessBridge.jar.

[0094] Step S402: The Java application initializes BitWorkerJavaBridge.dll and generates a JavaID.

[0095] Among them, JavaID can be used to identify the identity of the Java application when it interacts with the RPA application.

[0096] In the implementation of the present application, after BitWorkerJavaBridge.dll is loaded, the Java application can initialize it, specifically by calling some methods or functions in BitWorkerJavaBridge.dll. During the initialization process, each Java application can generate a JavaID.

[0097] Step S403: The Java application broadcasts the JavaID and starts an independent thread to monitor dbus messages.

[0098] In the implementation of the present application, the Java application may broadcast its corresponding JavaID in some way, for example, in the network or in the local system. This allows the RPA application to know the existence of this JavaID. At the same time, the Java application may start an independent thread to listen to dbus messages so that it can interact with the RPA application that uses dbus communication.

[0099] It can be understood that the Java application broadcasts the JavaID, so that the RPA application can also reply to the above-mentioned first asynchronous message after receiving the JavaID, so as to ensure that communication is successful even if the RPA application is started first and the Java application is started later.

[0100] The implementation method of the present application helps to establish a communication connection between a Java application and an RPA application and realize subsequent interactive operations by loading necessary library files, generating and broadcasting a JavaID, and starting a thread to listen to dbus messages.

[0101] In the Java automation process, it is necessary to simulate the user's operations on some Java elements, such as simulating clicking a button, inputting text, reading data, etc. Before performing the simulated operation, it is necessary to determine the location of the corresponding Java element, that is, to find the element first.

[0102] In view of this, in some implementations of the present application, after the RPA application receives the element identifier of the target Java element, the method may further include steps S501 to S504.

[0103] Step S501: The RPA application obtains a window handle according to the element identifier, and sends the window handle to the Java application corresponding to the element identifier.

[0104] Step S502: After receiving the window handle, the Java application returns the window information to the RPA application.

[0105] Step S503: The RPA application obtains the sub-node element information according to the window information, and determines whether the element corresponding to the sub-node element information meets the target element characteristics.

[0106] Step S504: When a Java element that meets the target element characteristics is found, the RPA application determines the Java element that meets the target element characteristics as the target element.

[0107] Among them, the target element feature is a unique feature of the target element and can be set according to usage experience.

[0108] In an embodiment of the present application, the RPA application can first obtain the corresponding window handle according to the element identifier obtained in step S107, that is, obtain the unique identifier of the window, and send the window handle to the Java application. After the Java application receives the window handle, it can obtain the corresponding window information according to the window handle and return the window information to the RPA application. After the RPA application receives the window information, it can further obtain the sub-node element information of the sub-node under the window according to the window information, and the sub-node element information may include some attributes or position information related to the target element. Then the RPA application can determine whether the element corresponding to the sub-node element information meets the target element characteristics, for example, the attributes, position, content, etc. of the element can be compared and analyzed. When a Java element that meets the target element characteristics is found, the RPA application can determine the Java element as the target element.

[0109] It can be understood that when the RPA application determines whether the element corresponding to the sub-node element information meets the target element characteristics, if the child node of the window node does not meet the target element characteristics, it can search for the child node element of the child node, and continue to determine whether the child node element of the child node meets the target element characteristics, and repeat this step until the target element is found.

[0110] The implementation manner of the present application realizes the goal of finding a Java element that meets the characteristics of a target element under a given element identifier by cooperating between an RPA application and a Java application.

[0111] In some implementations of the present application, the RPA application obtains the mouse position and determines whether the application corresponding to the mouse position is a Java application, which may further include steps S601 to S604.

[0112] Step S601: The RPA application obtains the mouse position and the window handle under the mouse position, and sends a query message to all Java applications that are in communication with the RPA application.

[0113] The inquiry message is used to indicate whether the Java application includes a corresponding window.

[0114] In an embodiment of the present application, the RPA application can obtain the current mouse position information and the window handle under the mouse position, that is, the window currently pointed to by the mouse. Then, the RPA application can send a query message to all Java applications connected to it, asking them whether they contain the window corresponding to the window handle.

[0115] Step S602: All Java applications receive the inquiry message and determine whether the Java application includes a window corresponding to the window handle.

[0116] In the implementation manner of the present application, after all Java applications receive the inquiry message, these Java applications will check whether their own windows correspond to the window handle.

[0117] Step S603: The Java application including the window returns a confirmation message to the RPA application, and the Java application not including the window returns a denial message to the RPA application.

[0118] In the implementation of the present application, if a Java application finds a window corresponding to the window handle, it will return a confirmation message to the RPA application, indicating that the window is its. If it does not find the corresponding window, it will return a denial message, indicating that the window is not its. Specifically, the confirmation message can be true, and the denial message can be false.

[0119] Step S604: The RPA application determines whether the application corresponding to the mouse position is a Java application based on the confirmation message and the denial message.

[0120] In an embodiment of the present application, the RPA application can receive feedback information from all Java applications, and then determine whether the application at the current position of the mouse is a Java application based on this information. For example, if all Java applications return a denial message, the RPA application can determine that the application at the current position of the mouse is not a Java application. If a Java application returns a confirmation message, it can be determined that the Java application is under the current position of the mouse.

[0121] In some other implementations of the present application, the RPA application obtains the mouse position and determines whether the application corresponding to the mouse position is a Java application, which may further include the following steps:

[0122] The RPA application obtains the application name of the application corresponding to the mouse position, and determines whether the corresponding application is a Java application according to the application name.

[0123] In the implementation of the present application, the RPA application can use the system's own API function, third-party tool library, custom script or plug-in, etc. to obtain the application name of the application corresponding to the mouse position. After obtaining the application name of the application corresponding to the mouse position, the RPA application can determine whether the application name contains java or javaw. If it does, it can be determined that the corresponding application is a Java application; if not, it can be determined that the corresponding application is not a Java application.

[0124] Figure 2 A structural diagram of an element selection system provided in an embodiment of the present application is shown. The element selection system 2 can be configured on a terminal device. Specifically, the element selection system 2 can include an RPA application 21 and a Java application 22.

[0125] The RPA application 21 may be used to establish a communication connection with the Java application 22;

[0126] The RPA application 21 can also be used to obtain the mouse position and determine whether the application corresponding to the mouse position is a Java application 22;

[0127] When the application corresponding to the mouse position is a Java application 22, the RPA application 21 may also be used to receive the JavaID of the corresponding target Java application 22, and send the mouse position to the target Java application 22 via the JavaID, the target Java application 22 being the Java application 22 corresponding to the mouse position;

[0128] The target Java application 22 may be used to receive the mouse position, obtain element information of all Java elements under the mouse position, and return the element information of all Java elements to the RPA application 21;

[0129] The RPA application 21 is further used to receive element information of all Java elements, determine a target Java element based on the element information of all Java elements, and send a query request to the target Java application 22;

[0130] The target Java application 22 may also be used to query the parent node element information of the target Java element based on the query request, and generate the element identifier of the target Java element according to the element information of the target Java element and the parent node element information;

[0131] The RPA application 21 may also be configured to receive an element identifier of a target Java element.

[0132] Compared with the prior art, the beneficial effects of the embodiment of the present application are as follows: In the embodiment of the present application, the RPA application 21 establishes a communication connection with the Java application 22, obtains the mouse position, and sends the mouse position to the target Java application 22. According to the element information of all Java elements under the mouse position returned by the target Java application 22, the target element is determined, and the element information of the target Java element and the parent node element information are obtained, thereby obtaining the element identifier of the target Java element. By adopting the embodiment of the present application, the element identifier of the Java element can be automatically obtained under the Linux operating system.

[0133] In some implementations of the present application, the RPA application 21 establishes a communication connection with the Java application 22, which may include: the RPA application 21 loads BitWorkerBridge.dl, initializes BitWorkerBridge.dll, and generates an RPAID;

[0134] The RPA application 21 starts an independent thread to listen to the dbus message and broadcasts the first asynchronous message, the content of which includes the RPAID; after receiving the first asynchronous message, all Java applications 22 return a second asynchronous message to the RPA application 21, and the content of the second asynchronous message includes the JavaID corresponding to each Java application 22; after receiving the second asynchronous message, the RPA application 21 creates a shared memory between the Java application 22, uses the RPAID and the JavaID as identifiers of the shared memory, and sends a synchronization message to the Java application 22 corresponding to the JavaID, and the content of the synchronization message includes the identifier; the Java application 22 reads the identifier, obtains the shared memory, and writes a confirmation message to the shared memory; the RPA application 21 reads the confirmation message of the shared memory to determine that a communication connection has been successfully established with the Java application 22.

[0135] In some embodiments of the present application, the system may further include: the RPA application 21 creates a thread lock and locks the shared memory before writing a message to the shared memory; the Java application 22 creates a thread lock and locks the shared memory before reading the message in the shared memory; after the Java application 22 writes the message to the shared memory, the shared memory is released from the thread lock; after the RPA application 21 reads the message in the shared memory, the shared memory is released from the thread lock.

[0136] In some embodiments of the present application, before the above-mentioned RPA application 21 establishes a communication connection with the Java application 22, the system may also include: the Java application 22 loads AcessBridge.jar, and loads BitWorkerJavaBridge.dll through AcessBridge.jar; the Java application 22 initializes BitWorkerJavaBridge.dll and generates a JavaID; the Java application 22 broadcasts the JavaID and starts an independent thread to listen to dbus messages.

[0137] In some embodiments of the present application, after the above-mentioned RPA application 21 receives the element identifier of the target Java element, the system may also include: the RPA application 21 obtains the window handle according to the element identifier, and sends the window handle to the Java application 22 corresponding to the element identifier; after receiving the window handle, the Java application 22 returns the window information to the RPA application 21; the RPA application 21 obtains the sub-node element information according to the window information, and determines whether the element corresponding to the sub-node element information meets the target element characteristics; when a Java element that meets the target element characteristics is found, the RPA application 21 determines the Java element that meets the target element characteristics as the target element.

[0138] In some embodiments of the present application, the above-mentioned RPA application 21 obtains the mouse position and determines whether the application corresponding to the mouse position is a Java application 22, which may include: the RPA application 21 obtains the mouse position and the window handle under the mouse position, and sends an inquiry message to all Java applications 22 that are connected to the RPA application 21 for communication; all Java applications 22 receive the inquiry message and determine whether the Java application 22 contains a window corresponding to the window handle; the Java application 22 containing the window returns a confirmation message to the RPA application 21, and the Java application 22 not containing the window returns a denial message to the RPA application 21; the RPA application 21 determines whether the application corresponding to the mouse position is a Java application 22 based on the confirmation message and the denial message.

[0139] In some embodiments of the present application, the above-mentioned RPA application 21 obtains the mouse position and determines whether the application corresponding to the mouse position is a Java application 22, and may also include: the RPA application 21 obtains the application name of the application corresponding to the mouse position, and determines whether the corresponding application is a Java application 22 according to the application name.

[0140] like Figure 3FIG. 1 is a schematic diagram of a terminal device provided in an embodiment of the present application. The terminal device 3 may include: a processor 31, a memory 32, and a computer program 33 stored in the memory 32 and executable on the processor 31, such as an element selection program. When the processor 31 executes the computer program 33, the steps in the above-mentioned element selection method embodiment are implemented, such as Figure 1 Steps S101 to S107 are shown.

[0141] The computer program may be divided into one or more modules / units, which are stored in the memory 32 and executed by the processor 31 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the terminal device.

[0142] The terminal device may include, but is not limited to, a processor 31 and a memory 32. Those skilled in the art will appreciate that Figure 3 It is only an example of a terminal device and does not constitute a limitation of the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access equipment, buses, etc.

[0143] The processor 31 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0144] The memory 32 may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. The memory 32 may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device. Further, the memory 32 may also include both an internal storage unit of the terminal device and an external storage device. The memory 32 is used to store the computer program and other programs and data required by the terminal device. The memory 32 may also be used to temporarily store data that has been output or is to be output.

[0145] It should be noted that, for the convenience and brevity of description, the structure of the above-mentioned terminal device can also refer to the specific description of the structure in the method embodiment, which will not be repeated here.

[0146] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0147] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned element selection method can be implemented.

[0148] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned element selection method when executing the computer program product.

[0149] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0150] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0151] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0152] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0153] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0154] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0155] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for selecting an element, characterized in that: The element selection method is applied to an element selection system, the system includes an RPA application and a Java application, and the method includes: The RPA application establishes a communication connection with the Java application; The RPA application obtains the mouse position, and determines whether the application corresponding to the mouse position is a Java type application; When the application corresponding to the mouse position is a Java type application, the RPA application receives the JavaID of the corresponding target Java application, and sends the mouse position to the target Java application through the JavaID, and the target Java application is the Java application corresponding to the mouse position; The target Java application receives the mouse position, obtains element information of all Java elements under the mouse position, and returns the element information of all Java elements to the RPA application; The RPA application receives element information of all the Java elements, determines a target Java element based on the element information of all the Java elements, and sends a query request to the target Java application; The target Java application queries the parent node element information of the target Java element based on the query request, and generates an element identifier of the target Java element according to the element information of the target Java element and the parent node element information; The RPA application receives an element identifier of the target Java element; The RPA application establishes a communication connection with the Java application, including: The RPA application loads BitWorkerBridge.dll, initializes the BitWorkerBridge.dll, and generates an RPAID; The RPA application starts an independent thread to monitor dbus messages and broadcasts a first asynchronous message, where the content of the first asynchronous message includes the RPAID; After receiving the first asynchronous message, all the Java applications return a second asynchronous message to the RPA application, where the content of the second asynchronous message includes a JavaID corresponding to each Java application; After receiving the second asynchronous message, the RPA application creates a shared memory with the Java application, uses the RPAID and the JavaID as identifiers of the shared memory, and sends a synchronization message to the Java application corresponding to the JavaID, where the content of the synchronization message includes the identifier; The Java application reads the identifier, obtains the shared memory, and writes a confirmation message into the shared memory; The RPA application reads the determination message in the shared memory and determines that a communication connection is successfully established with the Java application.

2. The method for selecting an element according to claim 1, characterized in that: The method further comprises: The RPA application creates a thread lock and sets the thread lock on the shared memory before writing a message to the shared memory; The Java application creates a thread lock and sets a thread lock on the shared memory before reading a message in the shared memory; After the Java application writes a message to the shared memory, the Java application releases the thread lock of the shared memory; After reading the message in the shared memory, the RPA application releases the thread lock of the shared memory.

3. The method for selecting an element according to claim 1, characterized in that: Before the RPA application establishes a communication connection with the Java application, the method further includes: The Java application loads AcessBridge.jar, and loads BitWorkerJavaBridge.dll through the AcessBridge.jar; The Java application initializes the BitWorkerJavaBridge.dll to generate the JavaID; The Java application broadcasts the JavaID and starts an independent thread to listen to dbus messages.

4. The method for selecting an element according to claim 1, characterized in that: After the RPA application receives the element identifier of the target Java element, the method further includes: The RPA application obtains a window handle according to the element identifier, and sends the window handle to a Java application corresponding to the element identifier; After receiving the window handle, the Java application returns window information to the RPA application; The RPA application obtains the sub-node element information according to the window information, and determines whether the element corresponding to the sub-node element information meets the target element characteristics; When a Java element satisfying the target element characteristic is found, the RPA application determines the Java element satisfying the target element characteristic as the target element.

5. The method for selecting an element according to claim 1, characterized in that: The RPA application obtains the mouse position and determines whether the application corresponding to the mouse position is a Java type application, including: The RPA application obtains the mouse position and the window handle under the mouse position, and sends an inquiry message to all the Java applications that are in communication with the RPA application; All the Java applications receive the inquiry message and determine whether the Java application includes a window corresponding to the window handle; The Java application including the window returns a confirmation message to the RPA application, and the Java application not including the window returns a denial message to the RPA application; The RPA application determines whether the application corresponding to the mouse position is a Java type application based on the confirmation message and the denial message.

6. The method for selecting an element according to claim 1, characterized in that: The RPA application obtains the mouse position and determines whether the application corresponding to the mouse position is a Java type application, including: The RPA application obtains an application name of an application corresponding to the mouse position, and determines whether the corresponding application is a Java type application according to the application name.

7. A system for selecting an element, characterized in that: The system includes an RPA application and a Java application; The RPA application is used to establish a communication connection with the Java application; The RPA application is further used to obtain a mouse position and determine whether an application corresponding to the mouse position is a Java type application; When the application corresponding to the mouse position is a Java type application, the RPA application is further used to receive a JavaID of a corresponding target Java application, and send the mouse position to the target Java application through the JavaID, and the target Java application is the Java application corresponding to the mouse position; The target Java application is used to receive the mouse position, obtain element information of all Java elements under the mouse position, and return the element information of all Java elements to the RPA application; The RPA application is further used to receive element information of all the Java elements, determine a target Java element based on the element information of all the Java elements, and send a query request to the target Java application; The target Java application is further used to query the parent node element information of the target Java element based on the query request, and generate an element identifier of the target Java element according to the element information of the target Java element and the parent node element information; The RPA application is further used to receive an element identifier of the target Java element; The RPA application is used to establish a communication connection with the Java application, including: The RPA application loads BitWorkerBridge.dll, initializes the BitWorkerBridge.dll, and generates an RPAID; The RPA application starts an independent thread to monitor dbus messages and broadcasts a first asynchronous message, where the content of the first asynchronous message includes the RPAID; After receiving the first asynchronous message, all the Java applications return a second asynchronous message to the RPA application, where the content of the second asynchronous message includes a JavaID corresponding to each Java application; After receiving the second asynchronous message, the RPA application creates a shared memory with the Java application, uses the RPAID and the JavaID as identifiers of the shared memory, and sends a synchronization message to the Java application corresponding to the JavaID, where the content of the synchronization message includes the identifier; The Java application reads the identifier, obtains the shared memory, and writes a confirmation message into the shared memory; The RPA application reads the determination message in the shared memory and determines that a communication connection is successfully established with the Java application.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the element selection method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for selecting an element according to any one of claims 1 to 6 are implemented.