Control positioning method, device, equipment and storage medium
By detecting the controls in the current form, obtaining their information, finding the target data set and extracting relevant data, the problem of difficulty in determining the controls to be operated by a single control attribute is solved, and efficient control positioning is achieved.
Patent Information
- Application Number
- CN202010714154.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2040-07-22
AI Technical Summary
During the control positioning process, it is difficult to accurately determine the control to be operated through a single control attribute, which makes it difficult to locate the control.
By detecting the current control in the current form, obtaining its corresponding control information, finding the target data set, extracting the target data and current logical relationship information, and then determining the control to be operated.
It realizes fast and accurate control positioning, improves control positioning efficiency, and simplifies operational process.
Smart Images

Figure CN113971058B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a control positioning method, device, equipment and storage medium. Background Art
[0002] At present, in the process of control positioning, a single control attribute is usually used to position the control. However, it is relatively complicated to determine the control to be operated by using a single control attribute, and it is relatively difficult to position the control.
[0003] Therefore, there is essentially a technical problem that the control positioning is difficult.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a control positioning method, device, equipment and storage medium, aiming to solve the technical problem of difficult control positioning.
[0006] To achieve the above object, the present invention provides a control positioning method, which comprises the following steps:
[0007] Detecting a current control in a current window, and obtaining current control information corresponding to the current control;
[0008] Find the target data set corresponding to the current control;
[0009] Extract target data from the target data set, and extract current logical relationship information from the current control information;
[0010] A control to be operated is determined according to the target data and the current logical relationship information.
[0011] Optionally, before detecting the target control in the current window and acquiring the target control information of the target control, the method further includes:
[0012] Get the pending control information corresponding to the pending control;
[0013] Determine the logic relationship information to be processed according to the control information to be processed;
[0014] Generate a data set to be selected according to the logical relationship information to be processed and a preset data structure template;
[0015] A corresponding relationship between the to-be-selected data set and the to-be-processed controls is established.
[0016] Optionally, generating a set of data to be selected according to the logical relationship information to be processed and a preset data structure template specifically includes:
[0017] Determine the data structure information corresponding to the control to be processed according to the logical relationship information to be processed and the preset data structure template;
[0018] Node information is extracted from the data structure information, and a to-be-selected data set is generated according to the node information.
[0019] Optionally, determining the data structure information corresponding to the to-be-processed control according to the to-be-processed logical relationship information and a preset data structure template specifically includes:
[0020] Generate a data structure to be processed corresponding to the control information to be processed according to the logical relationship information to be processed and a preset data structure template;
[0021] Determine data structure information corresponding to the control to be processed according to the data structure to be processed.
[0022] Optionally, extracting node information from the data structure information and generating a to-be-selected data set according to the node information specifically includes:
[0023] Extracting node information from the data structure information;
[0024] Determine the current node corresponding to the control to be processed according to the node information;
[0025] Determine the parent node, child node and containing node of the current node according to the node information;
[0026] A to-be-selected data set is generated according to the parent node, the child node, the containing node and the node information.
[0027] Optionally, extracting parent node information corresponding to the parent node, child node information corresponding to the child node, and included node information corresponding to the included node from the node information;
[0028] A to-be-selected data set is generated according to the parent node information, the child node information and the included node information.
[0029] Optionally, a parent node field is generated according to the parent node information, a child node field is generated according to the child node information, and an included node field is generated according to the included node information;
[0030] Generate the data to be selected according to the parent node field, the child node field, and the included node field;
[0031] A set of data to be selected is established according to the data to be selected.
[0032] Optionally, determining the control to be operated according to the target data and the current logical relationship information specifically includes:
[0033] Generate a current data structure corresponding to the current control information according to the current logical relationship information and a preset data structure template;
[0034] Determine the current data structure information corresponding to the current control according to the current data structure;
[0035] A control to be operated is determined according to the target data and the current data structure information.
[0036] Optionally, determining the control to be operated according to the target data and the current data structure information specifically includes:
[0037] Extracting target node information from the current data structure information;
[0038] Determine the target node corresponding to the current control according to the target node information;
[0039] Determine a target parent node, a target child node, and a target containing node of the target node according to the target node information;
[0040] A control to be operated is determined according to the target data, the target node information, the target parent node, the target child node, and the target containing node.
[0041] Optionally, determining the control to be operated according to the target data, the target node information, the target parent node, the target child node, and the target containing node specifically includes:
[0042] Extracting a parent node field from the target data;
[0043] Determine whether the parent node field is empty;
[0044] If the parent node field is not empty, extracting the target parent node information corresponding to the target parent node from the target node information;
[0045] Determine parent node information according to the parent node field, and compare the parent node information with the target parent node information;
[0046] When the parent node information is the same as the target parent node information, extracting a child node field from the target data;
[0047] A control to be operated is determined according to the sub-node field, the target node information, the target sub-node, and the target containing node.
[0048] Optionally, determining the control to be operated according to the sub-node field, the target information, the target sub-node, and the target containing node specifically includes:
[0049] Determine whether the subnode field is empty;
[0050] If the sub-node field is not empty, extracting the target sub-node information corresponding to the target sub-node from the target node information;
[0051] Determine the subnode information according to the subnode field, and compare the subnode information with the target subnode information;
[0052] When the sub-node information is the same as the target sub-node information, extracting a node field from the target data;
[0053] A control to be operated is determined according to the included node field, the target node information and the target included node.
[0054] Optionally, determining the control to be operated according to the included node field, the target node information and the target included node specifically includes:
[0055] Determine whether the included node field is empty;
[0056] If the included node field is not empty, extracting the target included node information corresponding to the target included node from the target node information;
[0057] Determine the included node information according to the included node field, and compare the included node information with the target included node information;
[0058] When the included node information is the same as the target included node information, the current control is used as the control to be operated.
[0059] Optionally, the detecting a current control in the current window and acquiring current control information corresponding to the current control specifically includes:
[0060] Traverse the controls in the current form and use the traversed controls as the current controls;
[0061] Get the current control information corresponding to the current control.
[0062] In addition, to achieve the above-mentioned purpose, the present invention also proposes a control positioning device, the control positioning device comprising:
[0063] A control detection module, used to detect the current control in the current form and obtain the current control information corresponding to the current control;
[0064] A data search module, used to search for a target data set corresponding to the current control;
[0065] An information extraction module, used to extract target data from the target data set and to extract current logical relationship information from the current control information;
[0066] A target determination module is used to determine a control to be operated according to the target data and the current logical relationship information.
[0067] Optionally, the control locating device also includes a control information module, which is used to obtain the control information to be processed corresponding to the control to be processed; determine the logical relationship information to be processed based on the control information to be processed; generate a data set to be selected based on the logical relationship information to be processed and a preset data structure template; and establish a corresponding relationship between the data set to be selected and the control to be processed.
[0068] Optionally, the control information module is further used to determine the data structure information corresponding to the control to be processed based on the logical relationship information to be processed and a preset data structure template; extract node information from the data structure information, and generate a data set to be selected based on the node information.
[0069] Optionally, the control information module is further used to generate a data structure to be processed corresponding to the control information to be processed according to the logical relationship information to be processed and a preset data structure template; and determine data structure information corresponding to the control to be processed according to the data structure to be processed.
[0070] Optionally, the control information module is also used to extract node information from the data structure information; determine the current node corresponding to the control to be processed based on the node information; determine the parent node, child node and containing node of the current node based on the node information; and generate a data set to be selected based on the parent node, the child node, the containing node and the node information.
[0071] In addition, to achieve the above-mentioned purpose, the present invention also proposes a control positioning device, which includes: a memory, a processor, and a control positioning program stored in the memory and executable on the processor, and the control positioning program is configured with steps to implement the control positioning method as described above.
[0072] In addition, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a control positioning program is stored, and when the control positioning program is executed by a processor, the steps of the control positioning method described above are implemented.
[0073] The control positioning method proposed by the present invention detects the current control in the current form and obtains the current control information corresponding to the current control; searches for the target data set corresponding to the current control; extracts the target data from the target data set and extracts the current logical relationship information from the current control information; and determines the control to be operated according to the target data and the current logical relationship information. By obtaining the current control information and searching for the corresponding target data set, the target data is obtained, and then the control to be operated is determined, thereby achieving the effect of quickly positioning the control and improving the efficiency of control positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a schematic diagram of the structure of a control positioning device in a hardware operating environment involved in an embodiment of the present invention;
[0075] Figure 2 This is a flow chart of a first embodiment of a control positioning method of the present invention;
[0076] Figure 3 This is a flow chart of a second embodiment of the control positioning method of the present invention;
[0077] Figure 4 A schematic diagram of a data structure to be processed in the second embodiment of the control positioning method of the present invention;
[0078] Figure 5 It is a schematic diagram of the flow chart of the third embodiment of the control positioning method of the present invention;
[0079] Figure 6 This is a schematic diagram of the functional modules of the first embodiment of the control positioning device of the present invention.
[0080] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0081] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0082] Reference Figure 1 , Figure 1 It is a schematic diagram of the structure of a control positioning device in a hardware operating environment involved in an embodiment of the present invention.
[0083] like Figure 1As shown, the control positioning device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a button, and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0084] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation on the control positioning device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0085] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a control positioning program.
[0086] exist Figure 1 In the control positioning device shown, the network interface 1004 is mainly used to connect to the external network and communicate data with other network devices; the user interface 1003 is mainly used to connect to the user device and communicate data with the user device; the device of the present invention calls the control positioning program stored in the memory 1005 through the processor 1001, and executes the control positioning method provided by the embodiment of the present invention.
[0087] Based on the above hardware structure, an embodiment of the control positioning method of the present invention is proposed.
[0088] Reference Figure 2 , Figure 2 This is a flow chart of the first embodiment of the control positioning method of the present invention.
[0089] In a first embodiment, the control positioning method includes the following steps:
[0090] Step S10, detecting a current control in the current window, and obtaining current control information corresponding to the current control.
[0091] It should be noted that the execution subject of this embodiment can be a control positioning device, or other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment, the control positioning device is used as an example for description.
[0092] It should be noted that the control positioning device may be a terminal device such as a computer, a mobile phone, a tablet computer, etc., and this embodiment does not limit this.
[0093] It should be noted that the technical solution described in this embodiment can be applied to a computer, a mobile phone or a tablet computer, and this embodiment does not limit this.
[0094] It should be noted that a form is the programming window and dialog box of an application. A form can contain multiple controls. A form is like a container that contains multiple controls. Almost every application must contain a form. If an application needs to contain multiple forms, they must be given different names, that is, different Name attributes. The window contains a list of properties that the selected form and control have at design time. These properties can be changed at design time. When the user selects multiple controls, the property list contained in the property window is shared by the selected controls.
[0095] It should be understood that after the current window is determined, the current control in the current window may be detected, and the current control information corresponding to the current control may be obtained.
[0096] Furthermore, the step of detecting a current control in the current window and obtaining current control information corresponding to the current control includes:
[0097] The controls in the current form are traversed, and the traversed control is used as the current control; and the current control information corresponding to the current control is obtained.
[0098] It should be understood that since there may be multiple controls in the current form, it will be better to first detect one control during the detection process, and then detect the next control after the detection is completed. Therefore, the controls in the current form can be traversed, the traversed control is used as the current control, and the current control information corresponding to the current control is obtained.
[0099] In a specific implementation, when there are three controls, namely, control A, control B, and control C, in the current form, the controls in the current form can be traversed. When traversing to control A, control A is used as the current control, and control information A corresponding to control A is obtained; when traversing to control B, control B is used as the current control, and control information B corresponding to control B is obtained; when traversing to control C, control C is used as the current control, and control information C corresponding to control C is obtained.
[0100] In this embodiment, the controls in the current form are traversed, and the traversed controls are used as the current controls; the current control information corresponding to the current controls is obtained, and the controls are detected in batches, thereby improving the accuracy of control positioning.
[0101] Step S20, searching for a target data set corresponding to the current control.
[0102] It should be understood that a correspondence between the control to be processed and the data set to be selected has been established in advance, and after the current control is determined, the target data set corresponding to the current control can be found according to the above correspondence.
[0103] It is understandable that the corresponding relationship between the control to be processed and the data set to be selected can be established by establishing a mapping relationship list based on the control to be processed and the data set to be selected, and searching for the target data set corresponding to the current control through the mapping relationship list. Other methods are also possible, and this embodiment does not limit this.
[0104] It should be understood that the target data set includes target data, and the target data may be composed of a parent node field, a child node field, and an included node field, and may also include other data, which is not limited in this embodiment.
[0105] Step S30, extracting target data from the target data set, and extracting current logical relationship information from the current control information.
[0106] It is understandable that after determining the target data set, the target data can be extracted from the target data set. After determining the current control information, the current logical relationship information can be extracted from the current control information, wherein the current logical relationship information is the logical relationship information corresponding to the current control. The current data structure corresponding to the current control information can be generated according to the current logical relationship information and the preset data structure template, and the target parent node, target child node and target containing node can be determined according to the current data structure. Among them, the preset data structure template can be a tree structure or other structures, which is not limited in this embodiment.
[0107] Step S40: determining a control to be operated according to the target data and the current logical relationship information.
[0108] It should be understood that after determining the target data and the current logical relationship, the control attribute matching and control structure matching of the current node can be performed according to the target data and the current logical relationship. When both the control attribute matching and the control structure matching are successful, the current control is used as the control to be operated.
[0109] In this embodiment, the current control in the current form is detected, and the current control information corresponding to the current control is obtained; the target data set corresponding to the current control is searched; the target data is extracted from the target data set, and the current logical relationship information is extracted from the current control information; the control to be operated is determined according to the target data and the current logical relationship information. By obtaining the current control information and searching the corresponding target data set, the target data is obtained, and then the control to be operated is determined, so as to achieve the effect of quickly locating the control and improve the efficiency of control positioning.
[0110] In one embodiment, if Figure 3 As shown, based on the first embodiment, a second embodiment of the control positioning method of the present invention is proposed. Before step S10, the method further includes:
[0111] Step S001, obtaining the control information to be processed corresponding to the control to be processed.
[0112] It should be understood that a data structure can be defined to describe the control information, with a new parent node field (parentView) describing the parent node information of the control, a child node field (child Views) describing the child node information of the current node of the control, and a contained node field (contain Views) describing the node information contained in the current node of the control without limiting the hierarchy.
[0113] It is understandable that before locating the control, a corresponding relationship between the to-be-selected data set and the to-be-processed control may be established. After the to-be-processed control is determined, the to-be-processed control information corresponding to the to-be-processed control may be obtained.
[0114] Step S002: determining the logical relationship information to be processed according to the control information to be processed.
[0115] It should be understood that after obtaining the control information to be processed, the logical relationship information to be processed can be determined based on the control information to be processed, and then the data structure to be processed can be generated based on the logical relationship to be processed, and the parent node, child node and containing node corresponding to the control to be processed can be determined based on the data structure to be processed.
[0116] Step S003: generating a data set to be selected according to the logical relationship information to be processed and a preset data structure template.
[0117] It is understandable that the preset data structure template may be a tree structure or other structures, and this embodiment does not limit this. In this embodiment, the preset data structure template is a tree structure as an example for description.
[0118] It should be understood that the data structure information corresponding to the control to be processed can be determined according to the logical relationship information to be processed and the preset data structure template, and then the data set to be selected is generated based on the data structure information corresponding to the control to be processed.
[0119] Furthermore, the step of generating a set of data to be selected according to the logical relationship information to be processed and a preset data structure template includes:
[0120] Generate a data structure to be processed corresponding to the control information to be processed according to the logical relationship information to be processed and a preset data structure template; determine data structure information corresponding to the control to be processed according to the data structure to be processed; extract node information from the data structure information, and generate a selected data set according to the node information.
[0121] It should be understood that after determining the logical relationship information to be processed, a data structure to be processed may be generated according to the logical relationship information to be processed and a preset data structure template, wherein the data structure to be processed may be a tree structure.
[0122] It can be understood that the data structure information corresponding to the control to be processed can be determined according to the data structure to be processed, such as Figure 4 As shown, Figure 4 Schematic diagram of the data structure to be processed. Taking node 1 in the figure as an example, node 0 is the parent node of node 1, nodes 2, 3, and 4 are child nodes of node 1, and nodes 2, 3, 4, 5, 6, 7, 8, 9, and 10 are included nodes of node 1, where the included nodes are nodes that are included in any level under the current node.
[0123] It is understandable that after determining the data structure to be processed, the data structure information corresponding to the control to be processed can be determined according to the data structure to be processed, and then the node information is extracted from the data structure information, and the selected data set is generated according to the extracted node information. Among them, the node information may include the information of each node and the relationship between each node, and may also include other information, which is not limited in this embodiment.
[0124] In this embodiment, the data structure to be processed corresponding to the control information to be processed is generated according to the logical relationship information to be processed and the preset data structure template; the data structure information corresponding to the control to be processed is determined according to the data structure to be processed; the node information is extracted from the data structure information, and the data set to be selected is generated according to the node information. Thus, the data structure to be processed corresponding to the control information to be processed is generated, the node information is extracted from it, and the data set to be selected is generated according to the node information, thereby improving the accuracy of the data set to be selected.
[0125] Furthermore, the step of extracting node information from the data structure information and generating a to-be-selected data set according to the node information includes:
[0126] Extract node information from the data structure information; determine the current node corresponding to the control to be processed according to the node information; determine the parent node, child node and containing node of the current node according to the node information; generate a data set to be selected according to the parent node, the child node, the containing node and the node information.
[0127] It should be understood that the node information can be extracted from the data structure information, and the current node corresponding to the control to be processed can be determined based on the node information, and then the parent node, child node and containing node of the current node can be determined based on the node information.
[0128] In the specific implementation, Figure 4 As shown, if the current node corresponding to the control to be processed is node 1, nodes 2, 3, and 4 are used as parent nodes, node 0 is used as a child node, and nodes 2, 3, 4, 5, 6, 7, 8, 9, and 10 are used as containing nodes.
[0129] It is understandable that after determining the node information, the parent node, the child node and the included node, a set of data to be selected may be generated according to the parent node, the child node, the included node and the node information.
[0130] In this embodiment, node information is extracted from the data structure information; the current node corresponding to the control to be processed is determined according to the node information; the parent node, child node and included node of the current node are determined according to the node information; and a data set to be selected is generated according to the parent node, the child node, the included node and the node information. Thus, the parent node, the child node and the included node are determined according to the node information, and then the data set to be selected is generated, thereby improving the efficiency of generating the data set to be selected.
[0131] Furthermore, the step of generating a set of data to be selected according to the parent node, the child node, the containing node and the node information includes:
[0132] Extract the parent node information corresponding to the parent node, the child node information corresponding to the child node, and the included node information corresponding to the included node from the node information; generate a parent node field according to the parent node information, generate a child node field according to the child node information, and generate an included node field according to the included node information; generate data to be selected according to the parent node field, the child node field, and the included node field; and establish a data set to be selected according to the data to be selected.
[0133] It should be understood that after determining the node information, parent node, child node and included node, the parent node information corresponding to the parent node can be extracted from the node information, the child node information corresponding to the child node can be extracted from the node information, and the included node information corresponding to the included node can be extracted from the node information.
[0134] It should be understood that the parent node field is generated according to the parent node information, the child node field is generated according to the child node information, and the included node field is generated according to the included node information, so that the parent node information is described by the parent node field, the child node information is described by the child node field, and the included node information is described by the included node field.
[0135] It is understandable that after the above node fields are generated, the candidate data can be generated according to the parent node field, the child node field and the included node field, and then the candidate data set can be established according to the candidate data. Thus, the corresponding candidate data can be extracted from the candidate data set, and the parent node field, the child node field and the included node field can be determined according to the candidate data.
[0136] In this embodiment, the parent node information corresponding to the parent node, the child node information corresponding to the child node, and the included node information corresponding to the included node are extracted from the node information; the parent node field is generated according to the parent node information, the child node field is generated according to the child node information, and the included node field is generated according to the included node information; the data to be selected is generated according to the parent node field, the child node field, and the included node field; and the data set to be selected is established according to the data to be selected. Thus, the parent node information, the child node information, and the included node information are first determined, and then the parent node field, the child node field, and the included node field are generated, and then the data set to be selected is generated, thereby improving the accuracy of the data.
[0137] Step S004: establishing a corresponding relationship between the to-be-selected data set and the to-be-processed controls.
[0138] It should be understood that after generating the data set to be selected, a corresponding relationship between the data set to be selected and the control to be processed can be established. Specifically, a mapping list can be established according to the data set to be selected and the control to be processed, so that the data set to be selected corresponding to the control to be processed can be easily found through the mapping list.
[0139] In this embodiment, by obtaining the control information to be processed corresponding to the control to be processed; determining the logical relationship information to be processed according to the control information to be processed; generating a data set to be selected according to the logical relationship information to be processed and a preset data structure template; and establishing a corresponding relationship between the data set to be selected and the control to be processed. Thus, the logical relationship information to be processed is extracted from the control information to be processed corresponding to the control to be processed, and the data set to be processed is established, thereby conveniently and quickly establishing a corresponding relationship between the data set to be processed and the control to be processed.
[0140] In one embodiment, if Figure 5 As shown, a third embodiment of the control positioning method of the present invention is proposed based on the first embodiment or the second embodiment. In this embodiment, the first embodiment is used for explanation, and the step S40 includes:
[0141] Step S401, generating a current data structure corresponding to the current control information according to the current logical relationship information and a preset data structure template.
[0142] It is understandable that the preset data structure template may be a tree structure or other structures, and this embodiment does not limit this. In this embodiment, the preset data structure template is a tree structure as an example for description.
[0143] It should be understood that after determining the current logical relationship information, a current data structure corresponding to the current control information can be generated according to the current logical relationship information and a preset data structure template, wherein the current data structure can be a tree structure.
[0144] Step S402: determining the current data structure information corresponding to the current control according to the current data structure.
[0145] It should be understood that after the current data structure is generated, the current data structure information corresponding to the current control can be determined based on the information of the current data structure.
[0146] Step S403: determining a control to be operated according to the target data and the current data structure information.
[0147] It is understandable that after obtaining the target data and the current data structure information, the data in the target data may be matched with the data in the current data structure information, and whether to use the current control as the control to be operated may be determined based on the matching result.
[0148] Furthermore, the step of determining the control to be operated according to the target data and the current data structure information includes:
[0149] Extract target node information from the current data structure information; determine the target node corresponding to the current control according to the target node information; determine the target parent node, target child node and target included node of the target node according to the target node information; determine the control to be operated according to the target data, the target node information, the target parent node, the target child node and the target included node.
[0150] It should be understood that the target node information can be extracted from the current data structure information, wherein the target node information may include information of each node and the relationship between each node, and may also include other information, which is not limited in this embodiment.
[0151] It can be understood that the target node corresponding to the current control can be determined according to the target node information, and then the parent node, child node and containing node of the target node can be determined according to the target node information.
[0152] In this embodiment, by extracting target node information from the current data structure information; determining the target node corresponding to the current control according to the target node information; determining the target parent node, target child node and target included node of the target node according to the target node information; and determining the control to be operated according to the target data, the target node information, the target parent node, the target child node and the target included node. Thus, the target parent node, the target child node and the target included node are first determined according to the current data structure information, and then the control to be operated is determined according to this information and the target data, thereby improving the accuracy of determining the control to be operated.
[0153] Further, the step of determining the control to be operated according to the target data, the target node information, the target parent node, the target child node and the target containing node includes:
[0154] Extracting a parent node field from the target data; determining whether the parent node field is empty; if the parent node field is not empty, extracting the target parent node information corresponding to the target parent node from the target node information; determining the parent node information according to the parent node field, and comparing the parent node information with the target parent node information; when the parent node information is the same as the target parent node information, extracting a child node field from the target data; determining a control to be operated according to the child node field, the target node information, the target child node, and the target containing node.
[0155] It should be understood that the non-empty fields in the target data are first matched with the target node information corresponding to the current control information, and the control structure is matched again only when all the non-empty fields in the target data are successfully matched.
[0156] It should be understood that the parent node matching is performed first, the parent node field is extracted from the target data, and it is determined whether the parent node field is empty.
[0157] It is understandable that when the parent node field is not empty, the target parent node information corresponding to the target parent node is extracted from the target node information. Furthermore, the parent node information described by the parent node field can be determined according to the parent node field, and the parent node information is compared with the target parent node information.
[0158] It can be understood that when the parent node information is the same as the target parent node information, the child node field is extracted from the target data to perform the next step of child node matching; when the parent node information is different from the target parent node information, it means that the current control is not the control to be operated, and the traversal operation continues to determine the new current control and repeat the above steps.
[0159] In this embodiment, by comparing the parent node information with the target parent node information, when the parent node information is the same as the target parent node information, the next step of child node matching is performed to determine the control to be operated, thereby improving the accuracy of the control to be operated.
[0160] Further, the step of determining the control to be operated according to the sub-node field, the target information, the target sub-node and the target containing node includes:
[0161] Determine whether the sub-node field is empty; if the sub-node field is not empty, extract the target sub-node information corresponding to the target sub-node from the target node information; determine the sub-node information according to the sub-node field, and compare the sub-node information with the target sub-node information; when the sub-node information is the same as the target sub-node information, extract the containing node field from the target data; determine the control to be operated according to the containing node field, the target node information and the target containing node.
[0162] It should be understood that after the parent node is matched, the child node is matched, the child node field is extracted from the target data, and it is determined whether the child node field is empty.
[0163] It is understandable that when the subnode field is not empty, the target subnode information corresponding to the target subnode is extracted from the target node information. Furthermore, the subnode information described by the subnode field can be determined according to the subnode field, and the subnode information is compared with the target subnode information.
[0164] It can be understood that when the child node information is the same as the target child node information, the included node field is extracted from the target data and the next step of included node matching is performed; when the child node information is different from the target child node information, it means that the current control is not the control to be operated, and the traversal operation continues to determine the new current control and repeat the above steps.
[0165] In this embodiment, by comparing the subnode information with the target subnode information, when the subnode information is the same as the target subnode information, the next step of including node matching is performed to determine the control to be operated, thereby improving the accuracy of the control to be operated.
[0166] Further, the step of determining the control to be operated according to the included node field, the target node information and the target included node includes:
[0167] Determine whether the included node field is empty; if the included node field is not empty, extract the target included node information corresponding to the target included node from the target node information; determine the included node information according to the included node field, and compare the included node information with the target included node information; when the included node information is the same as the target included node information, use the current control as the control to be operated.
[0168] It should be understood that after the child node matching is passed, the included node matching is performed. It is determined whether the included node field is empty. When the included node field is not empty, the target included node information corresponding to the target included node field is extracted from the target node information. Moreover, the included node information described by the included node field can be determined according to the included node field, and the included node information is compared with the target included node information.
[0169] It can be understood that when the included node information is the same as the target included node information, the current control is used as the control to be operated; when the included node information is different from the target included node information, it means that the current control is not the control to be operated, and the traversal operation continues to determine the new current control and repeat the above steps.
[0170] In this embodiment, by comparing the included node information with the target included node information, if the included node information is the same as the target included node information, the current control is used as the control to be operated, thereby improving the accuracy of the control to be operated.
[0171] In this embodiment, the current data structure corresponding to the current control information is generated according to the current logical relationship information and the preset data structure template; the current data structure information corresponding to the current control is determined according to the current data structure; and the control to be operated is determined according to the target data and the current data structure information. The current data structure corresponding to the current control information is generated, the current data structure information is extracted from it, and the control to be operated is determined by combining it with the target data, so that it can accurately determine whether the current control is the control to be tested, and quickly and accurately determine the control to be operated.
[0172] In addition, an embodiment of the present invention further provides a storage medium, on which a control positioning program is stored. When the control positioning program is executed by a processor, the steps of the control positioning method described above are implemented.
[0173] Since the storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0174] In addition, refer to Figure 6 The embodiment of the present invention further provides a control positioning device, the control positioning device comprising:
[0175] The control detection module 10 is used to detect the current control in the current window and obtain the current control information corresponding to the current control.
[0176] It should be noted that a form is the programming window and dialog box of an application. A form can contain multiple controls. A form is like a container that contains multiple controls. Almost every application must contain a form. If an application needs to contain multiple forms, they must be given different names, that is, different Name attributes. The window contains a list of properties that the selected form and control have at design time. These properties can be changed at design time. When the user selects multiple controls, the property list contained in the property window is shared by the selected controls.
[0177] It should be understood that after the current window is determined, the current control in the current window may be detected, and the current control information corresponding to the current control may be obtained.
[0178] Furthermore, the step of detecting a current control in the current window and obtaining current control information corresponding to the current control includes:
[0179] The controls in the current form are traversed, and the traversed control is used as the current control; and the current control information corresponding to the current control is obtained.
[0180] It should be understood that since there may be multiple controls in the current form, it will be better to first detect one control during the detection process, and then detect the next control after the detection is completed. Therefore, the controls in the current form can be traversed, the traversed control is used as the current control, and the current control information corresponding to the current control is obtained.
[0181] In a specific implementation, when there are three controls, namely, control A, control B, and control C, in the current form, the controls in the current form can be traversed. When traversing to control A, control A is used as the current control, and control information A corresponding to control A is obtained; when traversing to control B, control B is used as the current control, and control information B corresponding to control B is obtained; when traversing to control C, control C is used as the current control, and control information C corresponding to control C is obtained.
[0182] In this embodiment, the controls in the current form are traversed, and the traversed controls are used as the current controls; the current control information corresponding to the current controls is obtained, and the controls are detected in batches, thereby improving the accuracy of control positioning.
[0183] The data search module 20 is used to search for the target data set corresponding to the current control.
[0184] It should be understood that a correspondence between the control to be processed and the data set to be selected has been established in advance, and after the current control is determined, the target data set corresponding to the current control can be found according to the above correspondence.
[0185] It is understandable that the corresponding relationship between the control to be processed and the data set to be selected can be established by establishing a mapping relationship list based on the control to be processed and the data set to be selected, and searching for the target data set corresponding to the current control through the mapping relationship list. Other methods are also possible, and this embodiment does not limit this.
[0186] It should be understood that the target data set includes target data, and the target data may be composed of a parent node field, a child node field, and an included node field, and may also include other data, which is not limited in this embodiment.
[0187] The information extraction module 30 is used to extract target data from the target data set and to extract current logical relationship information from the current control information.
[0188] It is understandable that after determining the target data set, the target data can be extracted from the target data set. After determining the current control information, the current logical relationship information can be extracted from the current control information, wherein the current logical relationship information is the logical relationship information corresponding to the current control. The current data structure corresponding to the current control information can be generated according to the current logical relationship information and the preset data structure template, and the target parent node, the target child node, and the target containing node can be determined according to the current data structure.
[0189] The target determination module 40 is used to determine the control to be operated according to the target data and the current logical relationship information.
[0190] It should be understood that after determining the target data and the current logical relationship, the control attribute matching and control structure matching of the current node can be performed according to the target data and the current logical relationship. When both the control attribute matching and the control structure matching are successful, the current control is used as the control to be operated.
[0191] In this embodiment, the current control in the current form is detected, and the current control information corresponding to the current control is obtained; the target data set corresponding to the current control is searched; the target data is extracted from the target data set, and the current logical relationship information is extracted from the current control information; the control to be operated is determined according to the target data and the current logical relationship information. By obtaining the current control information and searching the corresponding target data set, the target data is obtained, and then the control to be operated is determined, so as to achieve the effect of quickly locating the control and improve the efficiency of control positioning.
[0192] In one embodiment, the control locating device further comprises a control information module, which is used to obtain the control information to be processed corresponding to the control to be processed; determine the logical relationship information to be processed based on the control information to be processed; generate a data set to be selected based on the logical relationship information to be processed and a preset data structure template; and establish a corresponding relationship between the data set to be selected and the control to be processed.
[0193] In one embodiment, the control information module is also used to determine the data structure information corresponding to the control to be processed based on the logical relationship information to be processed and a preset data structure template; extract node information from the data structure information, and generate a data set to be selected based on the node information.
[0194] In one embodiment, the control information module is further used to generate a data structure to be processed corresponding to the control information to be processed according to the logical relationship information to be processed and a preset data structure template; and determine data structure information corresponding to the control to be processed according to the data structure to be processed.
[0195] In one embodiment, the control information module is also used to extract node information from the data structure information; determine the current node corresponding to the control to be processed based on the node information; determine the parent node, child node and containing node of the current node based on the node information; and generate a set of data to be selected based on the parent node, the child node, the containing node and the node information.
[0196] In one embodiment, the control information module is also used to extract parent node information corresponding to the parent node, child node information corresponding to the child node, and included node information corresponding to the included node from the node information; and generate a set of data to be selected based on the parent node information, the child node information, and the included node information.
[0197] In one embodiment, the control information module is also used to generate a parent node field according to the parent node information, generate a child node field according to the child node information, and generate an included node field according to the included node information; generate data to be selected according to the parent node field, the child node field, and the included node field; and establish a data set to be selected based on the data to be selected.
[0198] In one embodiment, the target determination module 40 is also used to generate a current data structure corresponding to the current control information based on the current logical relationship information and a preset data structure template; determine the current data structure information corresponding to the current control based on the current data structure; and determine the control to be operated based on the target data and the current data structure information.
[0199] In one embodiment, the target determination module 40 is also used to extract target node information from the current data structure information; determine the target node corresponding to the current control according to the target node information; determine the target parent node, target child node and target inclusion node of the target node according to the target node information; determine the control to be operated according to the target data, the target node information, the target parent node, the target child node and the target inclusion node.
[0200] In one embodiment, the target determination module 40 is also used to determine the control to be operated based on the target data, the target node information, the target parent node, the target child node and the target included node, specifically including: extracting the parent node field from the target data; judging whether the parent node field is empty; if the parent node field is not empty, extracting the target parent node information corresponding to the target parent node from the target node information; determining the parent node information based on the parent node field, and comparing the parent node information with the target parent node information; when the parent node information is the same as the target parent node information, extracting the child node field from the target data; determining the control to be operated based on the child node field, the target node information, the target child node and the target included node.
[0201] In one embodiment, the target determination module 40 is also used to determine whether the sub-node field is empty; if the sub-node field is not empty, extract the target sub-node information corresponding to the target sub-node from the target node information; determine the sub-node information according to the sub-node field, and compare the sub-node information with the target sub-node information; when the sub-node information is the same as the target sub-node information, extract the containing node field from the target data; determine the control to be operated according to the containing node field, the target node information and the target containing node.
[0202] In one embodiment, the target determination module 40 is also used to determine whether the included node field is empty; if the included node field is not empty, extract the target included node information corresponding to the target included node from the target node information; determine the included node information according to the included node field, and compare the included node information with the target included node information; when the included node information is the same as the target included node information, use the current control as the control to be operated.
[0203] In one embodiment, the control detection module 10 is further used to traverse the controls in the current window, and use the traversed controls as the current controls; and obtain current control information corresponding to the current controls.
[0204] For other embodiments or specific implementation methods of the control positioning device of the present invention, reference may be made to the above-mentioned method embodiments, which will not be described in detail here.
[0205] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0206] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0207] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium (such as ROM / RAM, disk, CD) as described above, including a number of instructions for enabling an intelligent device (which can be a mobile phone, computer, control positioning device, air conditioner, or network control positioning device, etc.) to execute the methods described in each embodiment of the present invention.
[0208] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A control positioning method, characterized in that: The control positioning method comprises the following steps: Detecting a current control in a current window, and obtaining current control information corresponding to the current control; Searching for a target data set corresponding to the current control, wherein the target data set contains target data, and the target data is at least composed of a parent node field, a child node field, and a containing node field; Extract target data from the target data set, and extract current logical relationship information from the current control information; A control to be operated is determined according to the target data and the current logical relationship information.
2. The control positioning method according to claim 1, characterized in that: Before detecting the target control in the current window and obtaining the target control information of the target control, the method further includes: Get the pending control information corresponding to the pending control; Determine the logic relationship information to be processed according to the control information to be processed; Generate a data set to be selected according to the logical relationship information to be processed and a preset data structure template; A corresponding relationship between the to-be-selected data set and the to-be-processed controls is established.
3. The control positioning method according to claim 2, characterized in that: The step of generating a set of data to be selected according to the logical relationship information to be processed and a preset data structure template specifically includes: Determine the data structure information corresponding to the control to be processed according to the logical relationship information to be processed and the preset data structure template; Node information is extracted from the data structure information, and a to-be-selected data set is generated according to the node information.
4. The control positioning method according to claim 3, characterized in that: The determining the data structure information corresponding to the to-be-processed control according to the to-be-processed logical relationship information and the preset data structure template specifically includes: Generate a data structure to be processed corresponding to the control information to be processed according to the logical relationship information to be processed and a preset data structure template; Determine data structure information corresponding to the control to be processed according to the data structure to be processed.
5. The control positioning method according to claim 3, characterized in that: The step of extracting node information from the data structure information and generating a candidate data set according to the node information specifically includes: Extracting node information from the data structure information; Determine the current node corresponding to the control to be processed according to the node information; Determine the parent node, child node and containing node of the current node according to the node information; A to-be-selected data set is generated according to the parent node, the child node, the containing node and the node information.
6. The control positioning method according to claim 5, characterized in that: The generating of the to-be-selected data set according to the parent node, the child node, the included node and the node information specifically includes: Extracting the parent node information corresponding to the parent node, the child node information corresponding to the child node, and the included node information corresponding to the included node from the node information; A to-be-selected data set is generated according to the parent node information, the child node information and the included node information.
7. The control positioning method according to claim 6, characterized in that: The generating of the to-be-selected data set according to the parent node information, the child node information and the included node information specifically includes: Generate a parent node field according to the parent node information, generate a child node field according to the child node information, and generate an included node field according to the included node information; Generate the data to be selected according to the parent node field, the child node field, and the included node field; A set of data to be selected is established according to the data to be selected.
8. The control locating method according to any one of claims 1 to 7, wherein determining the control to be operated according to the target data and the current logical relationship information specifically comprises: Generate a current data structure corresponding to the current control information according to the current logical relationship information and a preset data structure template; Determine the current data structure information corresponding to the current control according to the current data structure; A control to be operated is determined according to the target data and the current data structure information.
9. The control positioning method according to claim 8, wherein determining the control to be operated according to the target data and the current data structure information specifically comprises: Extracting target node information from the current data structure information; Determine the target node corresponding to the current control according to the target node information; Determine a target parent node, a target child node, and a target containing node of the target node according to the target node information; A control to be operated is determined according to the target data, the target node information, the target parent node, the target child node, and the target containing node.
10. The control positioning method according to claim 9, wherein determining the control to be operated according to the target data, the target node information, the target parent node, the target child node, and the target containing node specifically comprises: Extracting a parent node field from the target data; Determine whether the parent node field is empty; If the parent node field is not empty, extracting the target parent node information corresponding to the target parent node from the target node information; Determine parent node information according to the parent node field, and compare the parent node information with the target parent node information; When the parent node information is the same as the target parent node information, extracting a child node field from the target data; A control to be operated is determined according to the sub-node field, the target node information, the target sub-node, and the target containing node.
11. The control locating method according to claim 10, wherein determining the control to be operated according to the sub-node field, the target node information, the target sub-node and the target containing node specifically comprises: Determine whether the subnode field is empty; If the sub-node field is not empty, extracting the target sub-node information corresponding to the target sub-node from the target node information; Determine the subnode information according to the subnode field, and compare the subnode information with the target subnode information; When the sub-node information is the same as the target sub-node information, extracting a node field from the target data; A control to be operated is determined according to the included node field, the target node information and the target included node.
12. The control positioning method according to claim 11, wherein determining the control to be operated according to the included node field, the target node information and the target included node specifically comprises: Determine whether the included node field is empty; If the included node field is not empty, extracting the target included node information corresponding to the target included node from the target node information; Determine the included node information according to the included node field, and compare the included node information with the target included node information; When the included node information is the same as the target included node information, the current control is used as the control to be operated.
13. The control positioning method according to any one of claims 1 to 7, wherein the step of detecting a current control in a current window and obtaining current control information corresponding to the current control comprises: Traverse the controls in the current form and use the traversed controls as the current controls; Get the current control information corresponding to the current control.
14. A control positioning device, characterized in that: The control positioning device comprises: A control detection module, used to detect the current control in the current form and obtain the current control information corresponding to the current control; A data search module, used to search for a target data set corresponding to the current control, wherein the target data set contains target data, and the target data is composed of at least a parent node field, a child node field, and an included node field; An information extraction module, used to extract target data from the target data set and to extract current logical relationship information from the current control information; A target determination module is used to determine a control to be operated according to the target data and the current logical relationship information.
15. The control positioning device as described in claim 14 further comprises a control information module, which is used to obtain the control information to be processed corresponding to the control to be processed; determine the logical relationship information to be processed based on the control information to be processed; generate a data set to be selected based on the logical relationship information to be processed and a preset data structure template; and establish a corresponding relationship between the data set to be selected and the control to be processed.
16. In the control positioning device as described in claim 15, the control information module is also used to determine the data structure information corresponding to the control to be processed based on the logical relationship information to be processed and a preset data structure template; extract node information from the data structure information, and generate a selected data set based on the node information.
17. The control positioning device as described in claim 16, wherein the control information module is further used to generate a data structure to be processed corresponding to the control information to be processed based on the logical relationship information to be processed and a preset data structure template; and determine the data structure information corresponding to the control to be processed based on the data structure to be processed.
18. According to the control positioning device as described in claim 17, the control information module is also used to extract node information from the data structure information; determine the current node corresponding to the control to be processed according to the node information; determine the parent node, child node and containing node of the current node according to the node information; generate a data set to be selected according to the parent node, the child node, the containing node and the node information.
19. A control positioning device, characterized in that: The control positioning device comprises: a memory, a processor, and a control positioning program stored in the memory and executable on the processor, wherein the control positioning program is configured with steps for implementing the control positioning method according to any one of claims 1 to 13.
20. A storage medium, characterized in that: The storage medium stores a control positioning program, which, when executed by a processor, implements the steps of the control positioning method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Method and device for acquiring logical position of control part
CN103455414A
Automatic testing method and device, storage medium and electronic equipment
CN108280026A