Batch grabbing method for structured elements of software interface
Technical Field
The invention relates to the field of RPA robot process automation, in particular to a batch grabbing method for software interface structural elements.
Background
Robot process automation (Robotic Process Automation, hereinafter referred to as RPA) is software running on a personal computer or a server, and has the main functions of simulating a person to control various system software and automatically execute a business process, and is suitable for a large-batch and high-repetition business scenario. One of the main functions of RPA robots is to acquire data on the system software interface, which includes structured data (structured data refers to data that exists in a fixed format within a record file, such as a table, a directory, etc.).
The main method for obtaining structured data at present is to call an application programming interface (Application Programming Interface, hereinafter abbreviated as API) provided by system software, and the method has the following problems:
1. invalidating system software that does not provide an API;
2. Invalidating structured data for the paged display;
3. Data that is not obvious to the structure is invalidated.
In order to solve the above technical problems, the solution proposed in the prior art is to acquire each data in the structuring separately and then splice the data according to the rule of discovery, however, the solution has the following problems:
1. Finding the regularity of structured data is difficult;
2. when the data volume is large, it takes time to acquire each data individually;
3. the obtained data is low in combination efficiency according to a specific rule and is easy to make mistakes.
Disclosure of Invention
The invention provides a batch grabbing method for structured elements of a software interface, which aims to solve the problems that system software does not provide an API (application program interface), data paging and an unobvious data structure when an RPA (remote procedure for processing) robot acquires structured data in the prior art, simplify the process of acquiring the resultant data by the RPA robot and improve the efficiency of acquiring the resultant data by the RPA robot.
The technical purpose of the invention is realized by the following technical scheme:
The batch grabbing method for the structured elements of the software interface comprises a development flow stage and an operation flow stage, wherein three selectors are obtained in the development flow stage and correspond to ancestor nodes, child node groups and target nodes in the child node groups respectively; and in the operation flow stage, the RPA robot extracts the structured data through three selectors to obtain a node group consisting of target nodes, acquires the attribute of the target nodes in the node group, and generates a two-dimensional array of the structured data according to the node group and the child node group.
Further, in the operation flow stage, when the structural data are in different pages, the RPA robot performs page turning operation, acquires the structural data of each page, and splices the acquired structural data together.
Further, the selector maintains element attributes and hierarchical relationships among the target node, child node group, and ancestor nodes.
Further, the development flow stage includes the following steps:
Manually selecting interface elements with the same type of two controls in the structured data;
Analyzing the hierarchy and the position relation of two interface elements by means of an analysis module, finding a common ancestor node of the two interface elements, and taking a selector of the ancestor node as a first selector;
Step three, obtaining all child node groups of ancestor nodes, and taking a selector for searching the child node groups from the ancestor nodes as a second selector;
step four, taking a selector of nodes with the same type of the searching control in the child node group as a third selector; if two interface elements in step 1 are at the child node group level, then the third selector is empty.
Further, in the operation flow stage, the RPA robot extracts the structured data through three selectors, and includes the following steps:
step 1, the RPA robot finds an ancestor node according to a first selector;
Step 2, the RPA robot finds a child node group according to the second selector;
Step 3, the RPA robot searches corresponding target nodes under the child nodes from each child node of the child node group according to the second selector and forms a target node group;
and 4, the RPA robot acquires the appointed attribute of the target node and forms a two-dimensional array of the structured data according to the target node group and the child node group.
Further, the analysis module is a syntax analysis algorithm.
Compared with the prior art, the invention has the beneficial effects that:
1. The batch grabbing method of the software interface structural elements supports system software which does not provide an API for extracting the structural data;
2. the method comprises the steps of automatically turning pages through an RPA robot to support acquisition of structured data of paging reality;
3. The method of the invention supports the extraction of data with unobvious structure;
4. The method is simple to operate, and the structural rule among the data is not required to be understood;
5. The generated result is three element selectors, the result relation of the data is intuitively displayed, and the understanding and the modification are convenient;
6. the method of the invention greatly improves the efficiency of obtaining the structured data.
Drawings
FIG. 1 is a schematic diagram of a system application interface element node in the present invention.
FIG. 2 is a diagram showing the structure of example 1.
FIG. 3 is a diagram showing the structure of example 2.
FIG. 4 is a diagram showing the structure of example 3.
Detailed Description
The technical scheme of the invention is further described below with reference to the specific embodiments:
1-4, a method for capturing structured elements of a software interface in batches, which includes a development process stage and an operation process stage, wherein the selector is a mode for selecting elements, and is stored and transmitted in text form, such as a CSS selector, and the selector is used for positioning the interface elements, some attributes of target interface elements and hierarchical relations among the elements are stored in the selector, and an RPA robot can position one or more interface elements meeting the conditions of the selector according to the attributes in the selector.
In the development flow stage, two interface elements in the structured data are captured, and three selectors are obtained through analysis:
Step one, manually selecting two interface elements (node A and node B for short) in the structured data, and prompting to re-select if the control types of the two interface elements (the control types are called as control type C) are different.
And step two, analyzing the hierarchy and the position relation of the two data by an analysis module, wherein the analysis module adopts a general grammar analysis algorithm to find a common ancestor node (called node G for short) of the two elements, and takes a selector of the node G as a first selector. The function of the grammar analysis algorithm is to analyze two input selector texts, generate three output selector texts according to specific rules, and indirectly realize the analysis processing of the selection conditions through the analysis processing of the texts.
Step three, obtaining all child node groups (called node group F for short) of the node G, and taking a selector for searching the node group F from the node G as a second selector;
Step four, a selector for searching a node of the control type C from a certain node in the node group F is used as a third selector; the third selector is empty if node a and node B are at the level of node group F, i.e. node a and node B belong directly to node G.
In the run-time phase, the RPA robot extracts structured data according to three selectors:
Step 1, the RPA robot finds a node G according to a first selector;
Step 2, the RPA robot finds a node group F according to the second selector;
Step 3, the RPA robot searches all target nodes from each node of the node group F according to a second selector and forms a target node group (node group C);
Step4, the RPA robot acquires the appointed attribute of the target node and forms a two-dimensional array of the structured data according to the node group C and the node group F;
And 5, if the page needs to be turned, the RPA robot automatically clicks a page turning button to turn the page, a new page acquires the structured data from the first step, and the data acquired before are spliced together.
The following description is made in connection with specific embodiments:
Taking a company as an example, the employee is regarded as an element, the name and the sex of the employee are regarded as element attributes, and the organization structure of the company corresponds to the hierarchical relationship of the elements.
Example 1
A men are development group members of the research and development department, B men are test group members of the research and development department;
analyzing the common points of the A men and the B men to generate three selectors which respectively correspond to the research and development departments, the group owners under the research and development departments and the male panelists managed by each group owner;
selector 1-select research and development department;
selector 2-select all group lengths;
Selector 3-select all male panelists;
the RPA robot extracts structured data through three selectors, and a table can be obtained, wherein the rows and columns of the table respectively correspond to the research and development department group length and male panelists managed by the corresponding research and development department group length.
Example 2
Male C is a development group leader of a research and development department, and female D is a test group leader of the research and development department; analyzing the common points of the male C and the female D to generate three selectors which respectively correspond to the research and development departments, group companies under the research and development departments and group members under the management of each group company;
selector 1-select research and development department;
selector 2-select all group lengths;
Selector 3-select to group leader itself, selector 3 is empty;
The RPA robot extracts structured data through three selectors, e.g., a single list may be obtained, containing all the group owners of the development department.
Example 3
Man E is a development group leader of a research and development department, and man F is a development group member of the research and development department; analysis of the commonality of men E and men F reveals that the positions of men E and men F relative to the common node development department are different, at different levels, and that the generation of the selector fails and needs to be re-selected.
The present embodiment is further illustrative of the present invention and is not to be construed as limiting the invention, and those skilled in the art can make no inventive modifications to the present embodiment as required after reading the present specification, but only as long as they are within the scope of the claims of the present invention.