Method, device, equipment and storage medium for correcting interface element positioning
By obtaining multiple positioning results and verification results, calculating the verification pass rate and correcting the error results using the positioning rules with the highest priority, the problem of inaccurate positioning of interface elements in Web automation tests is solved, and the accuracy and stability of positioning are achieved.
Patent Information
- Application Number
- CN202310294034.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-22
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2043-03-22
AI Technical Summary
In web automation testing, inaccurate positioning of interface elements leads to failure of automation testing, and it is difficult for the existing technology to maintain positioning accuracy when web pages are changed.
By obtaining multiple positioning results and verification results, the verification pass rate of the positioning rules is calculated, and the wrong positioning results are judged and corrected using the positioning rules with the highest priority to ensure the correctness and stability of the positioning results.
It improves the accuracy of interface element positioning, ensures that it can still successfully position when some positioning fails, achieves stability and robustness of positioning, and automatically repairs failed positioning.
Smart Images

Figure CN116561471B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer front-end technology, and in particular to a method, device, equipment and storage medium for correcting the positioning of interface elements. Background Art
[0002] In the automated testing of UI (User Interface) in the Web global wide area network, the positioning of interface elements is a very important step. Whether the positioning is correct is related to whether the corresponding elements can be found correctly during the automated testing process and whether the automation can be carried out smoothly.
[0003] Selenium is a commonly used technology in web automation testing. While it offers a wide range of positioning capabilities, it can only use one positioning rule for each element at a time. Consequently, when web pages change, it can't locate the required elements, causing automated testing to fail.
[0004] Therefore, how to improve the accuracy of interface element positioning results is a problem that needs to be solved at present. Summary of the Invention
[0005] The present disclosure aims to solve one of the technical problems in the related art at least to a certain extent.
[0006] The first embodiment of the present disclosure provides a method for correcting the positioning of interface elements, including:
[0007] Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule;
[0008] Calculating a first verification pass rate for each positioning rule according to each positioning result and the corresponding first verification result;
[0009] Based on the first verification pass rate and a first positioning result determined using a first positioning rule, determining whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is a positioning rule with the highest priority among the positioning rules;
[0010] If the judgment result is that there is the second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected.
[0011] A second embodiment of the present disclosure provides a device for correcting the positioning of interface elements, including:
[0012] An acquisition module, configured to acquire a plurality of positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule;
[0013] a calculation module, configured to calculate a first verification pass rate of each positioning rule according to each positioning result and a corresponding first verification result;
[0014] a judgment module, configured to judge whether there is a second positioning result to be corrected in the multiple positioning results based on the first verification pass rate and a first positioning result determined using a first positioning rule, wherein the first positioning rule is a positioning rule with the highest priority among the positioning rules;
[0015] The correction module is used to correct the second positioning result and the first verification result corresponding to the second positioning result when the judgment result is that there is the second positioning result to be corrected.
[0016] The third aspect embodiment of the present disclosure proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, it implements the method for correcting the positioning of interface elements proposed in the first aspect embodiment of the present disclosure.
[0017] The fourth embodiment of the present disclosure proposes a non-temporary computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for correcting the positioning of interface elements proposed in the first embodiment of the present disclosure.
[0018] The method, device, equipment, and storage medium for correcting the positioning of interface elements provided by the present disclosure have the following beneficial effects:
[0019] In the embodiment of the present disclosure, multiple positioning results and corresponding first verification results for the element to be positioned can be first obtained, and then the first verification pass rate of each positioning rule can be calculated based on each positioning result and the corresponding first verification result. Then, based on the first verification pass rate and the first positioning result determined by the first positioning rule, it is determined whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is the positioning rule with the highest priority among the positioning rules. Then, if the judgment result is that there is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. In this way, the correctness of the positioning result can be automatically verified, and the correctness of the positioning is guaranteed. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still perform positioning, ensuring the stability and robustness of the positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0020] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and / or additional aspects and advantages of the present disclosure will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0022] Figure 1 A flowchart of a method for correcting the positioning of interface elements provided by an embodiment of the present disclosure;
[0023] Figure 2 A flowchart of a method for correcting the positioning of interface elements provided by an embodiment of the present disclosure;
[0024] Figure 3 A flowchart of a method for correcting the positioning of interface elements provided by an embodiment of the present disclosure;
[0025] Figure 4 A flowchart of a method for correcting the positioning of interface elements provided by an embodiment of the present disclosure;
[0026] Figure 5 A structural block diagram of a device for correcting the positioning of interface elements provided by an embodiment of the present disclosure;
[0027] Figure 6 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0028] The following describes in detail embodiments of the present disclosure, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0029] The following describes the method, apparatus, computer device, and storage medium for correcting the positioning of interface elements according to embodiments of the present disclosure with reference to the accompanying drawings.
[0030] It should be noted that the execution entity of the interface element positioning correction method in the embodiments of the present disclosure is the interface element positioning correction device, which can be implemented by software and / or hardware. The device can be configured in a server or a processor of any electronic device, such as a mobile phone, tablet, or computer device, without limitation here. The following description of the interface element positioning correction method proposed in the embodiments of the present disclosure will use the "processor" as the execution entity, without limitation here.
[0031] As an example, the processor is used as the executor of the correction method for positioning interface elements. The processor may include a positioning parser, a positioning loader, and an element selector. The element selector may include an element configuration file, and the configuration file includes configuration information. The configuration information may include positioning keys, Selectors (positioning list), Selectors_Rules (positioning rules), Selectors_check (verification rules), defaultVaule (default value), Remark (remarks), etc., which are not limited here. Selectors contains a detailed positioning method. Selectors_Rules is the rule for generating Selectors, which corresponds one-to-one to the data of Selectors. Selectors_check can verify the searched elements.
[0032] Figure 1 A flowchart of a method for correcting the positioning of interface elements provided in an embodiment of the present disclosure.
[0033] like Figure 1 As shown, the method for correcting the positioning of the interface element may include the following steps:
[0034] Step 101: Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule.
[0035] The element to be located may be any UI (User Interface) element in the interface, that is, various controls, such as an input box, a drop-down menu, a search box, a form, a navigation bar, and a status bar, without limitation.
[0036] The positioning result may be a result obtained by positioning based on the positioning rule, and whether the positioning is successful may be determined by verifying the positioning result.
[0037] The positioning rule may be a rule for positioning the element to be positioned, for example, ID positioning, NAME positioning, positioning using xpath+attribute, TagName tag name positioning, PartialLinkText positioning, which is not limited here.
[0038] Among them, xpath is to divide the elements into paths and locate the elements according to the paths.
[0039] It is understandable that there are many positioning rules. Therefore, different positioning rules can be used to position the same element to be positioned, thereby improving the positioning accuracy.
[0040] The first verification result may be a verification result obtained by verifying the positioning result using a preset verification rule. By verifying the positioning result obtained by each positioning rule, it is possible to determine whether each positioning result is successful. It should be noted that when verifying the positioning result obtained by each positioning rule, the verification rules may be the same or different. The verification rule may be one or more, and is not limited here. It should be noted that if the first verification result of any positioning result is passed, it means that the positioning result is successfully located.
[0041] Optionally, when verifying any positioning result, the verification type can be a text value or an element type (such as a checkbox or input box), which is not limited here.
[0042] Step 102: Calculate the first verification pass rate of each positioning rule based on each positioning result and the corresponding first verification result.
[0043] Optionally, whether the positioning result based on each positioning rule is accurate may be determined based on each positioning result and the first verification result corresponding to each positioning result.
[0044] The first verification pass rate may be a pass rate calculated based on each positioning result and the corresponding first verification result.
[0045] For example, if the current element to be located is located using four positioning rules, four positioning results are obtained, namely a1, a2, a3, and a4, among which the first verification results corresponding to a1, a2, a3, and a4 are b1, b2, b3, and b4 respectively. If b1, b2, and b3 all pass the verification, and b4 fails the verification, it means that the positioning of a1, a2, and a3 is the same and the positioning is successful, while the positioning of a4 fails. Then it can be calculated that the first verification pass rate is 75%.
[0046] Step 103 : Based on the first verification pass rate and the first positioning result determined by using the first positioning rule, determine whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is the positioning rule with the highest priority among the positioning rules.
[0047] The first positioning rule is the positioning rule with the highest priority among all positioning rules, and may be, for example, positioning based on ID, or positioning based on xpath+attribute.
[0048] The first positioning result is a result obtained by positioning based on the first positioning rule.
[0049] The second positioning result to be corrected may be a result of positioning failure.
[0050] As an implementation manner, when the first positioning result is successful positioning and the first verification pass rate is equal to the first threshold, it can be determined that the judgment result is: there is no second positioning result to be corrected.
[0051] It can be understood that if the first positioning result is successful positioning, it means that the positioning result of the first positioning rule is correct, and the corresponding first verification result is passed.
[0052] The first threshold value may be 100%, which is not limited here. It is understood that if the first verification pass rate is 100%, then the positioning results of each positioning rule are correct, that is, all positioning is successful, and there is no second positioning result that needs to be corrected.
[0053] As an implementation method, when the first positioning result is successful positioning and the first verification pass rate is greater than the second threshold and less than the first threshold, the corresponding positioning result with a failed first verification result is used as the second positioning result to be corrected, and the judgment result is determined to be: the second positioning result to be corrected.
[0054] The second threshold is smaller than the first threshold, and may be, for example, 80% or 75%, which is not limited here.
[0055] It should be noted that if the first verification pass rate is greater than the second threshold and less than the first threshold, it means that some of the positioning results have been successfully verified, that is, some have failed positioning. Therefore, the positioning result with the first verification result failing can be used as the second positioning result to be corrected.
[0056] Step 104: If the judgment result is that the second positioning result needs to be corrected, correct the second positioning result and the first verification result corresponding to the second positioning result.
[0057] When correcting the second positioning result, the incorrect positioning result can be modified into a correct positioning result, and the value of the first verification result can be corrected to obtain a correct verification result. Specifically, the verification rule can be used to automatically correct the value of the verification result and generate positioning rules to correct the incorrect positioning.
[0058] In the embodiment of the present disclosure, multiple positioning results and corresponding first verification results for the element to be positioned can be first obtained, and then the first verification pass rate of each positioning rule can be calculated based on each positioning result and the corresponding first verification result. Then, based on the first verification pass rate and the first positioning result determined by the first positioning rule, it is determined whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is the positioning rule with the highest priority among the positioning rules. Then, if the judgment result is that there is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. In this way, the correctness of the positioning result can be automatically verified, and the correctness of the positioning is guaranteed. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still perform positioning, ensuring the stability and robustness of the positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0059] Figure 2 A flowchart of a method for correcting the positioning of interface elements provided in an embodiment of the present disclosure.
[0060] like Figure 2 As shown, the method for correcting the positioning of the interface element may include the following steps:
[0061] Step 201: Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule.
[0062] Step 202: Calculate the first verification pass rate of each positioning rule according to each positioning result and the corresponding first verification result.
[0063] It should be noted that the specific implementation of steps 201 and 202 can refer to the above embodiment and will not be described in detail here.
[0064] Step 203, when the first positioning result is successful positioning and the first verification pass rate is greater than the third threshold and less than or equal to the second threshold, each of the positioning results is verified based on the preset first verification rule to obtain a second verification result.
[0065] The third threshold is smaller than the second threshold, for example, it may be 40% or 50%, which is not limited here.
[0066] It can be understood that if the first verification pass rate is greater than the third threshold and less than or equal to the second threshold, it means that a small part of the current verification results are successfully verified. For example, among 6 positioning results, 2 may be successfully verified, that is, the corresponding first verification result is passed. At this time, the preset first verification rule can be used to verify each of the positioning results to obtain the second verification result.
[0067] The second verification result may be a positioning result obtained by verifying each positioning result using the first verification rule.
[0068] The first verification rule may be a preset weight verification rule, that is, the weight corresponding to each positioning rule and the positioning result may be used to determine whether the positioning is successful.
[0069] Optionally, you can first obtain the weight value corresponding to each positioning result for which each first verification result is passed, where the positioning rule corresponding to each positioning result has a preset weight value, and then add up the various weight values to obtain the weight sum. Then, when the weight sum is greater than the preset weight threshold, determine that the second verification result is passed, and then, when the weight sum is less than or equal to the weight threshold, determine that the second verification result is failed.
[0070] It should be noted that if there are four current positioning rules, namely A, B, C, and D, where A, B, C, and D have corresponding preset weights, such as 40%, 30%, 20%, and 10%, respectively, if the first verification results of the positioning results corresponding to A and B both pass, the weights corresponding to A and B can be added together to obtain a weighted sum of 70%. The preset weight threshold can be 50%. Since 70% is greater than 50%, the second verification result can be considered to pass.
[0071] Step 204: If the second verification result is passed, the corresponding positioning result whose first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
[0072] It can be understood that if the second verification result is failed, the positioning result with the first verification result failed can be used as the second positioning result to be corrected.
[0073] Step 205: If the judgment result is a second positioning result that needs to be corrected, correct the second positioning result and the first verification result corresponding to the second positioning result.
[0074] It should be noted that the specific implementation of step 205 can refer to the above embodiment and will not be described in detail here.
[0075] In an embodiment of the present disclosure, a plurality of positioning results and corresponding first verification results of the element to be positioned are first obtained, and then a first verification pass rate of each positioning rule is calculated based on each positioning result and the corresponding first verification result. Then, when the first positioning result is that the positioning is successful and the first verification pass rate is greater than a third threshold and less than or equal to a second threshold, each positioning result is verified based on a preset first verification rule to obtain a second verification result. Then, when the second verification result is passed, the positioning result whose corresponding first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected. Then, when the judgment result is that there is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. Therefore, when only a small part of the positioning results pass the verification, the first verification rule can be used to verify each positioning result again to determine whether the verification is passed. Then, based on the verification result, it is determined whether the corresponding positioning result with a failed first verification result needs to be used as the second positioning result to be corrected. From the perspective of weight, the accuracy of positioning can be improved. That is, when the weight of the positioning results that pass the first verification is relatively large, the second verification result can be considered to have passed the verification. The correctness of the positioning result can be automatically verified, which ensures the correctness of the positioning. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still perform positioning, ensuring the stability and robustness of the positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0076] Figure 3 A flowchart of a method for correcting the positioning of interface elements provided in an embodiment of the present disclosure.
[0077] like Figure 3 As shown, the method for correcting the positioning of the interface element may include the following steps:
[0078] Step 301: Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule.
[0079] It should be noted that the specific implementation of step 301 can refer to the above embodiment and will not be described in detail here.
[0080] Step 302: When the first positioning result is positioning failure, obtain the second verification pass rate corresponding to each third positioning result.
[0081] The third positioning result is a result of positioning the element to be positioned based on the second positioning rule, wherein the priority of the second positioning rule is lower than that of the first positioning rule.
[0082] The second verification pass rate is determined based on the first verification results corresponding to each third positioning result. The third positioning result is a positioning result other than the first positioning result. In other words, the third positioning result is the result of positioning according to a positioning rule other than the first positioning rule.
[0083] Optionally, if the first verification results corresponding to each third positioning result are all passed, the second verification pass rate is 100%.
[0084] Step 303: When the second verification pass rate reaches the first threshold, the first positioning result is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
[0085] It should be noted that if the first positioning result fails, but the other positioning results, that is, the third positioning result, are all successful, then the first positioning result can be used as the second positioning result to be repaired.
[0086] Step 304: When the first positioning result and each of the third positioning results indicate positioning failure, determine that the judgment result is: there is no second positioning result to be corrected.
[0087] It should be noted that if all positioning results fail, it means that the element to be positioned has failed to be positioned, and therefore no further correction is required.
[0088] Step 305: If the judgment result is a second positioning result that needs to be corrected, correct the second positioning result and the first verification result corresponding to the second positioning result.
[0089] It should be noted that the specific implementation of step 305 can refer to the above embodiment and will not be described in detail here.
[0090] In the embodiment of the present disclosure, multiple positioning results and corresponding first verification results for the element to be positioned are first obtained. Then, if the first positioning result is a positioning failure, the second verification pass rate corresponding to each of the third positioning results is obtained. Then, if the second verification pass rate reaches a first threshold, the first positioning result is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected. Then, if the first positioning result and each of the third positioning results are both positioning failures, the judgment result is determined to be: there is no second positioning result to be corrected. Finally, if the judgment result is that there is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. In this way, if the first positioning result is a positioning failure, it can be determined by the second verification pass rate of other positioning results whether there is a second positioning result to be corrected. If so, it needs to be corrected, so that the correctness of the positioning result can be automatically verified, ensuring the correctness of the positioning. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still perform positioning, ensuring the stability and robustness of positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0091] Figure 4 A flowchart of a method for correcting the positioning of interface elements provided in an embodiment of the present disclosure.
[0092] like Figure 4 As shown, the method for correcting the positioning of the interface element may include the following steps:
[0093] Step 401: Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule.
[0094] It should be noted that the specific implementation of step 401 can refer to the above embodiment and will not be described in detail here.
[0095] Step 402: When the first positioning result is positioning failure, obtain the second verification pass rate corresponding to each third positioning result.
[0096] Step 403 : When the second verification pass rate is greater than the fourth threshold and less than or equal to the first threshold, each positioning result is verified based on the preset first verification rule to obtain a second verification result.
[0097] The process of verifying each positioning result based on the preset first verification rule to obtain the second verification result can refer to the above embodiment and will not be described in detail here.
[0098] Step 404: If the second verification result is passed, the positioning result for which the first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: the second positioning result to be corrected.
[0099] The positioning result for which the first verification result fails includes the first positioning result, or may also include the third positioning result for which positioning fails. Therefore, the positioning result for which the first verification result fails may be used as the second positioning result to be corrected.
[0100] Step 405: When the second verification result is failed, determine the judgment result as: there is no second positioning result to be corrected.
[0101] It should be noted that if the second verification result is not passed, it means that the weight verification has failed, and thus the element positioning has failed. At this time, there is no need to determine the second positioning result to be corrected.
[0102] Step 406: When the second verification pass rate is less than or equal to the fourth threshold, determine that the judgment result is: there is no second positioning result to be corrected.
[0103] It should be noted that in some cases, the first positioning result fails, and the second verification pass rate corresponding to the third positioning result is also relatively low. Therefore, even if there is a successful third positioning result, it can be considered that the element positioning has failed.
[0104] Step 407: If the judgment result is that the second positioning result needs to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected.
[0105] It should be noted that the specific implementation of step 407 can refer to the above embodiment and will not be described in detail here.
[0106] In an embodiment of the present disclosure, multiple positioning results and corresponding first verification results of the element to be positioned are first obtained, and then, when the first positioning result is positioning failure, the second verification pass rate corresponding to each third positioning result is obtained, and then, when the second verification pass rate is greater than a fourth threshold and less than or equal to the first threshold, each positioning result is verified based on a preset first verification rule to obtain a second verification result, and then, when the second verification result is passed, the positioning result with a failed first verification result is used as the second positioning result to be corrected, and the judgment result is determined to be: a second positioning result to be corrected, and then, when the second verification pass rate is less than or equal to the fourth threshold, the judgment result is determined to be: there is no second positioning result to be corrected, and then, when the judgment result is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. Therefore, when a small part of the third positioning result passes, or is less than the fourth threshold, it can be judged whether the second positioning result needs to be corrected, so that the correctness of the positioning result can be automatically verified, ensuring the correctness of the positioning. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still be used for positioning, ensuring the stability and robustness of the positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0107] In order to implement the above embodiment, the present disclosure also proposes a device for correcting the positioning of interface elements.
[0108] Figure 5 This is a structural block diagram of the device for correcting the positioning of interface elements provided in the fifth embodiment of the present disclosure.
[0109] like Figure 5 As shown, the interface element positioning correction device 500 may include:
[0110] An acquisition module 510 is configured to acquire a plurality of positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule;
[0111] A calculation module 520 is configured to calculate a first verification pass rate of each positioning rule according to each positioning result and a corresponding first verification result;
[0112] a judgment module 530, configured to judge whether there is a second positioning result to be corrected in the plurality of positioning results based on the first verification pass rate and a first positioning result determined using a first positioning rule, wherein the first positioning rule is a positioning rule with the highest priority among the positioning rules;
[0113] The correction module 540 is configured to correct the second positioning result and the first verification result corresponding to the second positioning result when the judgment result indicates that there is the second positioning result to be corrected.
[0114] Optionally, the judgment module is specifically configured to:
[0115] When the first positioning result is successful positioning and the first verification pass rate is equal to the first threshold, determining that the judgment result is: there is no second positioning result to be corrected;
[0116] or,
[0117] When the first positioning result is successful positioning and the first verification pass rate is greater than the second threshold and less than the first threshold, the corresponding positioning result whose first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
[0118] Optionally, the judgment module includes:
[0119] a verification module, configured to, when the first positioning result is successful positioning and the first verification pass rate is greater than a third threshold and less than or equal to a second threshold, verify each of the positioning results based on a preset first verification rule to obtain a second verification result;
[0120] The judgment module is used to, when the second verification result is passed, use the corresponding positioning result whose first verification result is failed as the second positioning result to be corrected, and determine the judgment result as: there is the second positioning result to be corrected.
[0121] Optional verification module, specifically used for:
[0122] Obtaining a weight value corresponding to each of the positioning results for which the first verification result is passed, wherein the positioning rule corresponding to each of the positioning results has a preset weight value;
[0123] Adding the weight values to obtain a weighted sum;
[0124] If the weight sum is greater than a preset weight threshold, determining that the second verification result is passed;
[0125] When the weight sum is less than or equal to the weight threshold, the second verification result is determined to be failed.
[0126] Optionally, the judgment module is specifically configured to:
[0127] When the first positioning result is positioning failure, obtaining a second verification pass rate corresponding to each third positioning result;
[0128] When the second verification pass rate reaches the first threshold, the first positioning result is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
[0129] In a case where both the first positioning result and each of the third positioning results fail positioning, determining that a judgment result is: there is no second positioning result to be corrected;
[0130] The third positioning result is a result of positioning the element to be positioned based on the second positioning rule, wherein the priority of the second positioning rule is lower than that of the first positioning rule.
[0131] Optionally, the judgment module is specifically configured to:
[0132] When the second verification pass rate is greater than a fourth threshold and less than or equal to the first threshold, verifying each of the positioning results based on a preset first verification rule to obtain a second verification result;
[0133] If the second verification result is passed, taking the positioning result for which the first verification result is failed as the second positioning result to be corrected, and determining that the judgment result is: there is the second positioning result to be corrected;
[0134] When the second verification result is failure, the judgment result is determined to be: there is no second positioning result to be corrected.
[0135] Optionally, the judgment module is specifically configured to:
[0136] When the second verification pass rate is less than or equal to the fourth threshold, it is determined that the judgment result is: there is no second positioning result to be corrected.
[0137] In the embodiment of the present disclosure, multiple positioning results and corresponding first verification results for the element to be positioned can be first obtained, and then the first verification pass rate of each positioning rule can be calculated based on each positioning result and the corresponding first verification result. Then, based on the first verification pass rate and the first positioning result determined by the first positioning rule, it is determined whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is the positioning rule with the highest priority among the positioning rules. Then, if the judgment result is that there is a second positioning result to be corrected, the second positioning result and the first verification result corresponding to the second positioning result are corrected. In this way, the correctness of the positioning result can be automatically verified, and the correctness of the positioning is guaranteed. At the same time, the support of multiple positioning rules ensures that when one or more positioning methods fail, the remaining positioning methods can still perform positioning, ensuring the stability and robustness of the positioning, and the current successful positioning can be used to automatically repair the failed positioning.
[0138] In order to implement the above embodiments, the present disclosure also proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, it implements the correction method for the positioning of the interface elements proposed in the above embodiments of the present disclosure.
[0139] In order to implement the above embodiments, the present disclosure further proposes a non-temporary computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for correcting the positioning of interface elements proposed in the above embodiments of the present disclosure.
[0140] In order to implement the above embodiments, the present disclosure further proposes a computer program product. When the instruction processor in the computer program product is executed, the method for correcting the positioning of the interface elements proposed in the above embodiments of the present disclosure is executed.
[0141] It should be noted that, in the embodiment of the present disclosure, the correction method for positioning interface elements can be completed by a processor, and the processor can include a pre-processor, a task dispatcher, a task processor, and a post-processor, wherein the pre-processor logs in to the interface, switches to the corresponding position, and adjusts to the corresponding interface. The task dispatch processor can find the corresponding pending tasks, such as contract agency, business agency, and meeting agency, and distribute them to the corresponding processor for execution. The task processor processes the current node task, and the post-processor processes the exit process after processing the current node task. It is understandable that the element positioning used by the processor can be processed by a positioning device, such as a positioning loader and a positioning parser. And it can be based on a positioning template. When using the positioning template, different positioning types can be dynamically generated by passing in parameter values, satisfying one positioning type to implement different positioning methods, thereby ensuring the diversity of the business.
[0142] Figure 6 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Figure 6 The computer device 12 shown is only an example and should not bring any limitation to the functionality and scope of use of the embodiments of the present disclosure.
[0143] like Figure 6 As shown, computer device 12 is implemented as a general-purpose computing device. Components of computer device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and a bus 18 that connects various system components (including system memory 28 and processing unit 16).
[0144] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of such architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnection (PCI) bus.
[0145] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0146] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 6 Not shown, often called a "hard drive"). Although Figure 6Although not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a Compact Disc Read Only Memory (hereinafter referred to as: CD-ROM), a Digital Video Disc Read Only Memory (hereinafter referred to as: DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.
[0147] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally implement the functions and / or methods of the embodiments described herein.
[0148] The computer device 12 can also communicate with one or more external devices 14 (e.g., a keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). This communication can occur via an input / output (I / O) interface 22. Furthermore, the computer device 12 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with the other modules of the computer device 12 via a bus 18. It should be understood that, although not shown, other hardware and / or software modules can be used in conjunction with the computer device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0149] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the above embodiments.
[0150] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and features of different embodiments or examples, unless they are mutually inconsistent.
[0151] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. Throughout the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0152] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0153] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.
[0154] It should be understood that various parts of the present disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0155] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0156] In addition, the functional units in the various embodiments of the present disclosure may be integrated into a single processing module, or each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.
[0157] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure. A person of ordinary skill in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A method for correcting the positioning of interface elements, characterized in that: include: Acquire multiple positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule; Calculating a first verification pass rate for each positioning rule according to each positioning result and the corresponding first verification result; Based on the first verification pass rate and a first positioning result determined using a first positioning rule, determining whether there is a second positioning result to be corrected in the multiple positioning results, wherein the first positioning rule is a positioning rule with the highest priority among the positioning rules; If the judgment result is that there is the second positioning result to be corrected, correct the second positioning result and the first verification result corresponding to the second positioning result; The determining, based on the first verification pass rate and the first positioning result determined by using the first positioning rule, whether there is a second positioning result to be corrected in the multiple positioning results includes: When the first positioning result is successful positioning and the first verification pass rate is equal to the first threshold, determining that the judgment result is: there is no second positioning result to be corrected; If the first positioning result is successful positioning and the first verification pass rate is greater than the second threshold and less than the first threshold, taking the corresponding positioning result with a failed first verification result as the second positioning result to be corrected, and determining that the judgment result is: there is the second positioning result to be corrected; When the first positioning result is positioning failure, obtaining a second verification pass rate corresponding to each third positioning result; When the second verification pass rate reaches a first threshold, taking the first positioning result as a second positioning result to be corrected, and determining that a judgment result is: there is the second positioning result to be corrected; In a case where both the first positioning result and each of the third positioning results fail positioning, determining that a judgment result is: there is no second positioning result to be corrected; The third positioning result is a result of positioning the element to be positioned based on the second positioning rule, wherein the priority of the second positioning rule is lower than that of the first positioning rule.
2. The method according to claim 1, characterized in that The determining, based on the first verification pass rate and the first positioning result determined by using the first positioning rule, whether there is a second positioning result to be corrected in the multiple positioning results includes: When the first positioning result is successful positioning and the first verification pass rate is greater than a third threshold and less than or equal to a second threshold, verifying each of the positioning results based on a preset first verification rule to obtain a second verification result; When the second verification result is passed, the corresponding positioning result whose first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
3. The method according to claim 2, characterized in that The verifying each of the positioning results based on the preset first verification rule to obtain a second verification result includes: Obtaining a weight value corresponding to each of the positioning results for which the first verification result is passed, wherein the positioning rule corresponding to each of the positioning results has a preset weight value; Adding the weight values to obtain a weighted sum; If the weight sum is greater than a preset weight threshold, determining that the second verification result is passed; When the weight sum is less than or equal to the weight threshold, the second verification result is determined to be failed.
4. The method according to claim 1, wherein After obtaining the second verification pass rate corresponding to each third positioning result, the method further includes: When the second verification pass rate is greater than a fourth threshold and less than or equal to the first threshold, verifying each of the positioning results based on a preset first verification rule to obtain a second verification result; If the second verification result is passed, taking the positioning result for which the first verification result is failed as the second positioning result to be corrected, and determining that the judgment result is: there is the second positioning result to be corrected; When the second verification result is failure, the judgment result is determined to be: there is no second positioning result to be corrected.
5. The method according to claim 1, wherein After obtaining the second verification pass rate corresponding to each third positioning result, the method further includes: When the second verification pass rate is less than or equal to the fourth threshold, it is determined that the judgment result is: there is no second positioning result to be corrected.
6. A device for correcting the positioning of interface elements, characterized in that: include: An acquisition module, configured to acquire a plurality of positioning results and corresponding first verification results for the element to be positioned, wherein each positioning result has a corresponding positioning rule; a calculation module, configured to calculate a first verification pass rate of each positioning rule according to each positioning result and a corresponding first verification result; a judgment module, configured to judge whether there is a second positioning result to be corrected in the multiple positioning results based on the first verification pass rate and a first positioning result determined using a first positioning rule, wherein the first positioning rule is a positioning rule with the highest priority among the positioning rules; a correction module, configured to correct the second positioning result and the first verification result corresponding to the second positioning result when a judgment result indicates that there is the second positioning result to be corrected; The judgment module is specifically used to: When the first positioning result is successful positioning and the first verification pass rate is equal to the first threshold, determining that the judgment result is: there is no second positioning result to be corrected; If the first positioning result is successful positioning and the first verification pass rate is greater than the second threshold and less than the first threshold, taking the corresponding positioning result with a failed first verification result as the second positioning result to be corrected, and determining that the judgment result is: there is the second positioning result to be corrected; When the first positioning result is positioning failure, obtaining a second verification pass rate corresponding to each third positioning result; When the second verification pass rate reaches a first threshold, taking the first positioning result as a second positioning result to be corrected, and determining that a judgment result is: there is the second positioning result to be corrected; In a case where both the first positioning result and each of the third positioning results fail positioning, determining that a judgment result is: there is no second positioning result to be corrected; The third positioning result is a result of positioning the element to be positioned based on the second positioning rule, wherein the priority of the second positioning rule is lower than that of the first positioning rule.
7. The device according to claim 6, characterized in that The judgment module is specifically used to: When the first positioning result is successful positioning and the first verification pass rate is greater than a third threshold and less than or equal to a second threshold, verifying each of the positioning results based on a preset first verification rule to obtain a second verification result; When the second verification result is passed, the corresponding positioning result whose first verification result is failed is used as the second positioning result to be corrected, and the judgment result is determined to be: there is the second positioning result to be corrected.
8. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for correcting the positioning of the interface element as claimed in any one of claims 1 to 5 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for correcting the positioning of an interface element as described in any one of claims 1 to 5 is implemented.
10. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the method for correcting the positioning of an interface element as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data verification method and device, computer system and medium
CN111897842A
Automatic interface testing method and device, equipment, medium and program product
CN115374009A