Control positioning method, device, electronic device and readable storage medium
Through the preset pop-up window information library and interface sliding technology, the problem of pop-up window interference during the control positioning process is solved, the positioning success rate and efficiency are improved, and the automation of mobile application testing is realized.
Patent Information
- Application Number
- CN202110624451.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-04
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-06-04
AI Technical Summary
In mobile application testing, the control positioning process is easily affected by pop-up window occlusion, resulting in a high positioning failure rate and the inability to implement automated testing.
Determine whether there is a pop-up window in the application interface through the preset pop-up window information library, and close the pop-up window if it exists. If the positioning fails, slide the interface to expand the positioning range. Set the preset sliding number and positioning number thresholds to optimize the control positioning process.
It effectively gets rid of pop-up window interference, improves the accuracy and success rate of control positioning, reduces resource waste, and achieves fast and accurate positioning.
Smart Images

Figure CN113535542B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a control positioning method, device, electronic equipment and readable storage medium. Background Art
[0002] Mobile application testing includes automated testing and manual testing. Appium, one of the top ten free mobile application testing frameworks, is an open source, cross-platform automated testing tool that supports developers to write scripts on the computer to control the execution of automated test cases on the mobile terminal.
[0003] When testing mobile applications, it is necessary to locate the controls of the mobile applications. The current common method for locating controls is: connect the computer and the mobile phone through a data cable, use the Appium tool on the computer to control the mobile phone to open the application (APP), locate the control according to the text or relative position of the control on the application page, and then click or verify the located control to complete the automated test.
[0004] When the location and search path of the control to be clicked or verified in the application are known, and the application does not automatically pop up a pop-up window, the above solution can be used. However, when the control is blocked by the permission pop-up window and the control position is unpredictable, this solution cannot correctly locate the control, and thus cannot implement the automated testing function. Summary of the invention
[0005] The present invention provides a control positioning method, device, electronic device and readable storage medium, which are used to solve the defects of the prior art that pop-up windows are easily blocked during the control positioning process and the failure rate of positioning the control on the current page is high, and realize fast and accurate positioning of the control.
[0006] The present invention provides a control positioning method, comprising: judging whether there is a pop-up window on the application interface based on a preset pop-up window information library;
[0007] In response to the pop-up window existing in the application interface, closing the pop-up window and performing control positioning based on the control text to be positioned;
[0008] In response to a failure in executing the control positioning, the application interface is slid, and the determination of whether a pop-up window exists on the application interface is continued.
[0009] According to a control positioning method provided by the present invention, sliding the application interface includes: in response to the number of sliding the application interface not reaching a preset number of sliding times, sliding the application interface.
[0010] According to a control positioning method provided by the present invention, the control method also includes: the method also includes: in response to the number of sliding the application interface reaching a preset number of sliding times, outputting information that the control does not exist and / or outputting screenshot information of the application interface.
[0011] According to a control positioning method provided by the present invention, the control positioning based on the control text to be positioned includes: performing a single control positioning based on the control text to be positioned; in the case of positioning failure, repeatedly performing the single control positioning until the number of positioning times reaches a preset positioning number threshold.
[0012] According to a control positioning method provided by the present invention, the method of determining whether a pop-up window exists in an application interface based on a preset pop-up window information library specifically includes: obtaining control information of the application interface, and determining whether a pop-up window exists in the application interface by comparing and matching the control information with the pop-up window information library.
[0013] According to a control positioning method provided by the present invention, sliding the application interface includes: sliding the application interface by a preset distance, and the ratio of the preset distance to the current screen height is within a preset range.
[0014] According to a control positioning method provided by the present invention, after determining whether a pop-up window exists in the application interface, the control positioning method further comprises: if the pop-up window does not exist in the application interface, directly performing control positioning based on the control text to be positioned.
[0015] The present invention also provides a control positioning device, including: a pop-up window judgment module, used to judge whether there is a pop-up window on the application interface based on a preset pop-up window information library; a control positioning module, used to close the pop-up window in response to the existence of the pop-up window on the application interface, and perform control positioning based on the control text to be positioned; an interface sliding module, used to slide the application interface in response to the failure of executing the control positioning, and continue to execute the judgment whether there is a pop-up window on the application interface.
[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above control positioning methods are implemented.
[0017] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned control positioning methods are implemented.
[0018] The present invention provides a control positioning method, device, electronic device and readable storage medium, which filter pop-up windows on the application interface based on a preset pop-up window information library, get rid of the pop-up window interference in the control positioning process, and expand the positioning range of the control positioning process through a sliding interface, overcoming the problem of low control positioning success rate caused by the fixed application interface, and realizes fast and accurate positioning of the control based on the above process. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 This is one of the flow charts of the control positioning method provided by the present invention;
[0021] Figure 2 This is the second flow chart of the control positioning method provided by the present invention;
[0022] Figure 3 It is a structural schematic diagram of the control positioning device provided by the present invention;
[0023] Figure 4 is a schematic diagram of the structure of an electronic device provided by the present invention; DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] Figure 1 It is one of the flow charts of the control positioning method provided by the present invention, such as Figure 1 As shown, the method includes:
[0026] Step S110, based on a preset pop-up window information library, determine whether there is a pop-up window on the application interface.
[0027] After a software is written, it is often necessary to conduct software testing. Software testing is an important means to ensure software quality, based on which the reliability and quality of the software can be improved. During the software testing process, the positioning of the controls in the software is the basis for all subsequent tests and is a key step in software testing. During the control positioning process, pop-up windows in the application interface will interfere with the control positioning, such as blocking the target control, making it impossible to accurately position the control.
[0028] Based on this, a pop-up window judgment process is performed in step S110. First, based on a preset pop-up window information library, it is judged whether there is a pop-up window on the application interface. The preset pop-up window information library is a collection of information containing common pop-up windows. The information of common pop-up windows includes text information on the pop-up window, such as "Please close", "Close", "Click to close", etc., which are textual instruction information on the pop-up window, and also includes feature information of the pop-up window itself, such as "the area of the pop-up window", "the location where the pop-up window appears", and "the aspect ratio of the pop-up window". It should be noted that the pop-up window information contained in the pop-up window information library here is editable, that is, the pop-up window information library can realize information updating and supplementation. After completing the judgment on whether there is a pop-up window on the application interface, it jumps to the next process at the same time, that is, the control positioning process corresponding to step S120.
[0029] Step S120, in response to the pop-up window existing in the application interface, closing the pop-up window, and performing control positioning based on the control text to be positioned.
[0030] The text of the control to be located is pre-acquired based on the control to be located on the application interface. If there is a pop-up window on the application interface, it is closed and the control is located based on the text of the control to be located. It should be noted that the text of the control is pre-acquired based on the control on the application interface. Depending on the control to be located, the corresponding text of the control to be located is obtained to locate the control.
[0031] Step S130, in response to the failure of executing the control positioning, sliding the application interface and continuing to execute the determination whether there is a pop-up window on the application interface.
[0032] During the automated testing of software, when positioning the controls of the software under test, its application interface often cannot slide, that is, the application interface is fixed, and the fixation of the application interface during the control positioning process will cause problems such as a high control positioning failure rate and incorrect output positioning results. Step S130 corresponds to the interface sliding process. In step S130, when the control positioning fails, the application interface is automatically slid. The sliding process does not require human intervention and jumps back to the pop-up window judgment process in step S110. That is, the interface sliding process in step S130 expands the positioning range of the control positioning process and improves the success rate of control positioning.
[0033] The control positioning method provided by the present invention achieves filtering of pop-up windows on the application interface based on a preset pop-up window information library, thereby getting rid of the interference of pop-up windows in the control positioning process, and at the same time expands the positioning range of the control positioning process through a sliding interface, overcoming the problem of low control positioning success rate caused by the fixed application interface, and realizing fast and accurate positioning of the control based on the above process.
[0034] Furthermore, the sliding of the application interface in the present invention includes: in response to the number of sliding the application interface not reaching a preset number of sliding times, sliding the application interface.
[0035] In the present invention, the positioning range of the control positioning process is actually expanded by sliding the application interface, and each time the interface sliding process is started, the positioning range of the application interface is expanded once. In the actual control positioning process, if there is no control to be positioned in the current interface, the control cannot be positioned no matter how many times it is slid. If the sliding and control positioning operations are continuously performed, it will cause a great waste of resources. Therefore, it is necessary to set a threshold for the number of sliding times for the interface sliding process to avoid invalid sliding. In the present invention, a preset number of sliding times is set as the threshold for the number of sliding times, that is, to judge whether the number of sliding application interfaces reaches the preset number of sliding times. If the number of sliding application interfaces does not reach the preset number of sliding times, the application interface is slid and the pop-up window judgment process is transferred; if the number of sliding application interfaces reaches the preset number of sliding times, the page sliding process is ended and the control positioning result is output.
[0036] The control positioning method provided by the present invention, by setting a preset number of sliding times as a threshold of the number of sliding times, can expand the control positioning range, improve the control positioning success rate, and avoid the generation of invalid interface sliding, thereby maximizing process efficiency and avoiding waste of resources.
[0037] Furthermore, the control positioning method in the present invention further includes: in response to the number of sliding the application interface reaching a preset number of sliding times, outputting information that the control does not exist and / or outputting screenshot information of the application interface.
[0038] When the number of sliding application interfaces reaches the preset number of sliding times, the page sliding process ends and the control positioning result is output; the positioning result can be output in the following three ways:
[0039] ① Output information that the control does not exist;
[0040] ② Output screenshots of the application interface;
[0041] ③ Output information that the control does not exist and a screenshot of the application interface.
[0042] For the above three types of output control positioning results, each can separately express the result that the control does not exist.
[0043] The control locating method provided by the present invention enriches the output mode and output content of the locating result by expressing the "control does not exist" locating result in different ways, and the tester can select as needed to complete the acquisition of the locating result.
[0044] Furthermore, the control positioning based on the control text to be positioned described in the present invention includes: performing a single control positioning based on the control text to be positioned; in case of positioning failure, repeatedly performing the single control positioning until the number of positioning times reaches a preset positioning times threshold.
[0045] In the process of control positioning, the quality of network connection is required to be high. In the actual positioning process, due to the limitation of the test environment, the network may be unstable. In order to improve the reliability of the test process and avoid the influence of network instability on the normal control positioning process, the control positioning process is further optimized. Specifically, step S120, i.e., the control positioning process, is as follows: a single control positioning is performed based on the text of the control to be positioned. When the single control positioning fails, wait for two seconds, and then repeat the single control positioning. The number of repetitions of the single control positioning can be preset. In the present invention, a preset positioning number threshold is set, i.e., when the number of single control positioning reaches the preset positioning number threshold, the control positioning process is terminated and the page sliding process is jumped to.
[0046] The control positioning method provided by the present invention, by refining step S120, embeds a repeatable single control positioning process in the control positioning process, effectively avoiding the influence of network instability on the control positioning process, and ensuring the stability and reliability of the control positioning process.
[0047] Furthermore, the present invention determines whether a pop-up window exists in an application interface based on a preset pop-up window information library, including: obtaining control information of the application interface, and determining whether a pop-up window exists in the application interface by comparing and matching the control information with the pop-up window information library.
[0048] A control refers to the encapsulation of data and methods. A control can have its own properties and methods, where properties are simple accessors to control data, and methods are some simple and visible functions of controls, so a pop-up window is essentially a control. As mentioned above, a pop-up window information library is a collection of information containing common pop-ups. The information of common pop-ups includes text information on the pop-up window, such as "Please close", "Close", "Click to close" and other text instructions on the pop-up window, and also includes the feature information of the pop-up window itself, such as "the area of the pop-up window", "the location where the pop-up window appears" and "the aspect ratio of the pop-up window". In the present invention, the control information of the application interface is first obtained, and then the obtained control information is compared and matched with the information in the preset pop-up window information library. If the match is successful, it means that there is a pop-up window in the application interface; if the match fails, it means that there is no pop-up window in the application interface.
[0049] The control locating method provided by the present invention determines whether there is a pop-up window on the application interface by comparing and matching the acquired control information of the application interface with the information in the preset pop-up window information library, thereby achieving accurate judgment of the pop-up window on the application interface, and further facilitating the filtering process of the pop-up window.
[0050] Furthermore, the sliding of the application interface in the present invention includes: sliding the application interface a preset distance, and the ratio of the preset distance to the current screen height is within a preset range.
[0051] In step S130, when sliding the application interface, the corresponding sliding distance h can be fixed for each sliding of the application interface, and the size of the h value can be manually set in advance. When the h value is set too small, it will cause a waste of the control positioning process; when the h value is set too large, it will cause a significant reduction in the control positioning efficiency. After many experiments, it was found that when the application interface is slid once, when the ratio of the sliding distance of the application interface to the current screen height is in the range of (1 / 4, 1), it has a better control positioning efficiency. Considering the efficiency and usability, the sliding distance can be set to 1 / 2 of the current screen height.
[0052] According to current usage habits, when a mobile terminal or other device displays an application interface, the top portion of the application interface is initially displayed, so the application interface is slid upwards when sliding. If the bottom portion of the application interface is initially displayed, the application interface is slid downwards when sliding.
[0053] The control positioning method provided by the present invention improves the control positioning efficiency by sliding the application interface by a preset distance, wherein the ratio of the preset distance to the current screen height is within a preset interval.
[0054] Furthermore, in the present invention, after determining whether a pop-up window exists in the application interface, the method further comprises: if the pop-up window does not exist in the application interface, directly performing control positioning based on the text of the control to be positioned.
[0055] The control positioning method provided by the present invention promptly exits the pop-up window judgment process after confirming that there is no pop-up window on the application interface, and enters the next control positioning process, thereby avoiding process waste and improving the overall flow efficiency of the process.
[0056] Figure 2 This is the second flow chart of the control positioning method provided by the present invention. Figure 2 As shown, first configure the pop-up window information library, preset the positioning number threshold and the sliding number; the pop-up window information library is a collection of information containing common pop-ups, and the information of common pop-ups includes text information on the pop-up window, such as "Please close", "Close", "Click to close" and other text instructions on the pop-up window, and also includes the feature information of the pop-up window itself, such as "area of the pop-up window", "position of the pop-up window" and "aspect ratio of the pop-up window". The preset positioning number threshold and the sliding number can be pre-set according to actual needs. The preset positioning number threshold is for the process of repeating a single control positioning, and the sliding number is for the process of repeating the interface sliding.
[0057] Step 1: Determine whether there is a pop-up window on the application interface. If there is no pop-up window, jump directly to the control positioning process; if there is a pop-up window, close the pop-up window first and then jump to the control positioning process.
[0058] Step 2: In the control positioning process, a single control positioning is performed based on the control text to be positioned, and whether the control positioning is successful is determined. If the control positioning is successful, the positioning success information is output; if the positioning is unsuccessful, it is determined whether the number of positioning times reaches the preset positioning times threshold. If the number of positioning times does not reach the preset positioning times threshold, the single control positioning is continued based on the control text to be positioned, and the positioning times are increased by one each time the single control positioning is performed; if the number of positioning times reaches the preset positioning times threshold, it jumps to the interface sliding process.
[0059] Step 3, in the interface sliding process, determine whether the number of times the application interface is slid reaches the preset number of sliding times. If the number of times the application interface is slid does not reach the preset number of sliding times, slide the application interface up 1 / 2 of the current screen and jump to Step 1, continue the control positioning process, and each time the interface is slid, the number of times the application interface is slid increases by one; if the number of times the application interface is slid reaches the preset number of sliding times, output information that the control does not exist and / or take a screenshot of the application interface.
[0060] The control positioning method provided by the present invention achieves filtering of pop-up windows on the application interface based on a preset pop-up window information library, thereby getting rid of the interference of pop-up windows in the control positioning process, and at the same time expands the positioning range of the control positioning process through a sliding interface, overcoming the problem of low control positioning success rate caused by the fixed application interface, and realizing fast and accurate positioning of the control based on the above process.
[0061] Figure 3 Schematic diagram of the structure of a control positioning device provided by the present invention. Figure 3 As shown, the device includes a pop-up window determination module 310, a control positioning module 320 and an interface sliding module 330, wherein:
[0062] A pop-up window determination module 310 is used to determine whether there is a pop-up window on the application interface based on a preset pop-up window information library;
[0063] The control positioning module 320 is used to close the pop-up window in response to the presence of the pop-up window in the application interface, and perform control positioning based on the control text to be positioned.
[0064] The interface sliding module 330 is used to slide the application interface in response to the failure of executing the control positioning, and continue to execute the determination whether there is a pop-up window on the application interface.
[0065] The control positioning device provided by the present invention achieves filtering of pop-up windows on the application interface based on a preset pop-up window information library, thereby getting rid of the interference of pop-up windows in the control positioning process, and at the same time expands the positioning range of the control positioning process through a sliding interface, thereby overcoming the problem of low control positioning success rate caused by the fixed application interface, and realizing fast and accurate positioning of the control based on the above process.
[0066] According to a control positioning device provided by the present invention, when the interface sliding module 330 is used to slide the application interface, it is used to: in response to the number of sliding the application interface not reaching the preset number of sliding times, slide the application interface.
[0067] The control positioning device provided by the present invention sets a preset number of sliding times as a threshold of the number of sliding times, thereby expanding the control positioning range and improving the control positioning success rate while avoiding the generation of invalid interface sliding, thereby maximizing process efficiency and avoiding waste of resources.
[0068] According to a control positioning device provided by the present invention, the control positioning device is also used to output information that the control does not exist and / or output screenshot information of the application interface in response to the number of sliding the application interface reaching a preset number of sliding times.
[0069] The control locating device provided by the present invention enriches the output mode and output content of the locating result by expressing the "control does not exist" locating result in different ways, and the tester can select as needed to complete the acquisition of the locating result.
[0070] According to a control positioning device provided by the present invention, the control positioning module 320, when used to perform control positioning based on the control text to be positioned, is used to: perform a single control positioning based on the control text to be positioned; in the event of positioning failure, repeatedly perform the single control positioning until the number of positioning times reaches a preset positioning time threshold.
[0071] The control positioning device provided by the present invention refines the control positioning process and embeds a repeatable single control positioning process in the control positioning process, thereby effectively avoiding the influence of network instability on the control positioning process and ensuring the stability and reliability of the control positioning process.
[0072] According to a control positioning device provided by the present invention, the pop-up window judgment module 310, when used to judge whether a pop-up window exists in an application interface based on a preset pop-up window information library, is used to: obtain control information of the application interface, and judge whether a pop-up window exists in the application interface by comparing and matching the control information with the pop-up window information library.
[0073] The control locating device provided by the present invention determines whether there is a pop-up window on the application interface by comparing and matching the acquired control information of the application interface with the information in the preset pop-up window information library, thereby achieving accurate judgment of the pop-up window on the application interface, and further facilitating the filtering process of the pop-up window.
[0074] According to a control positioning device provided by the present invention, when the interface sliding module 330 is used to slide the application interface, it is specifically used to: slide the application interface by a preset distance, and the ratio of the preset distance to the current screen height is within a preset range.
[0075] The control positioning device provided by the present invention improves the control positioning efficiency by sliding the application interface a preset distance, wherein the ratio of the preset distance to the current screen height is within a preset interval.
[0076] According to a control positioning device provided by the present invention, after determining whether a pop-up window exists in the application interface, the pop-up window determination module 310 is further used to directly trigger the control positioning module 320 to perform control positioning based on the control text to be positioned if the pop-up window does not exist in the application interface.
[0077] The control positioning device provided by the present invention avoids process waste and improves the overall flow efficiency of the process by promptly jumping out of the pop-up window judgment process and entering the next control positioning process after confirming that there is no pop-up window on the application interface.
[0078] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the control positioning method, which includes: judging whether there is a pop-up window on the application interface based on a preset pop-up window information library; in response to the presence of the pop-up window on the application interface, closing the pop-up window and performing control positioning based on the control text to be positioned; in response to the failure of executing the control positioning, sliding the application interface and continuing to perform the judgment whether there is a pop-up window on the application interface.
[0079] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0080] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the control positioning method provided by the above-mentioned methods, and the method includes: based on a preset pop-up window information library, determining whether there is a pop-up window on the application interface; in response to the existence of the pop-up window on the application interface, closing the pop-up window and performing control positioning based on the text of the control to be positioned; in response to the failure of executing the control positioning, sliding the application interface and continuing to execute the determination of whether there is a pop-up window on the application interface.
[0081] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned control positioning methods, the method comprising: judging whether a pop-up window exists in an application interface based on a preset pop-up window information library; in response to the existence of the pop-up window in the application interface, closing the pop-up window and performing control positioning based on the text of the control to be positioned; in response to a failure to perform the control positioning, sliding the application interface and continuing to perform the judgment whether a pop-up window exists in the application interface.
[0082] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution 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 can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A control positioning method, characterized in that: include: Based on the preset pop-up window information library, determine whether there is a pop-up window on the application interface; In response to the pop-up window existing in the application interface, the pop-up window is closed, and control positioning is performed based on the control text to be positioned, wherein the control positioning is performed based on the control text to be positioned, including: Perform single control positioning based on the text of the control to be positioned; In the case of positioning failure, the single control positioning is repeatedly performed until the number of positioning times reaches a preset positioning times threshold; In response to the failure of executing the control positioning, the application interface is automatically slid, and the determination of whether a pop-up window exists on the application interface is continued, wherein the automatically sliding the application interface includes: In response to the number of sliding the application interface not reaching the preset number of sliding, automatically sliding the application interface; In response to the number of sliding the application interface reaching a preset number of sliding times, outputting information that the control does not exist and / or outputting screenshot information of the application interface; The automatically sliding the application interface includes: sliding the application interface a preset distance, wherein a ratio of the preset distance to a current screen height is within a preset range.
2. The control positioning method according to claim 1, characterized in that: The step of determining whether a pop-up window exists on the application interface based on a preset pop-up window information library includes: The control information of the application interface is obtained, and whether a pop-up window exists in the application interface is determined by comparing and matching the control information with the pop-up window information library.
3. The control positioning method according to claim 1, characterized in that: After determining whether a pop-up window exists on the application interface, the method further includes: if the pop-up window does not exist on the application interface, directly performing control positioning based on the text of the control to be positioned.
4. A control positioning device, characterized in that: include: A pop-up window determination module is used to determine whether there is a pop-up window on the application interface based on a preset pop-up window information library; A control positioning module, for closing the pop-up window in response to the presence of the pop-up window in the application interface, and performing control positioning based on the control text to be positioned, wherein the control positioning module, when used to perform control positioning based on the control text to be positioned, is used to: perform a single control positioning based on the control text to be positioned; if positioning fails, repeatedly perform the single control positioning until the number of positioning times reaches a preset positioning times threshold; The interface sliding module is used for automatically sliding the application interface in response to the failure of executing the control positioning, and continuing to execute the determination whether there is a pop-up window on the application interface, wherein the automatic sliding of the application interface includes: In response to the number of sliding the application interface not reaching the preset number of sliding, automatically sliding the application interface; In response to the number of sliding the application interface reaching a preset number of sliding times, outputting information that the control does not exist and / or outputting screenshot information of the application interface; The automatically sliding the application interface includes: sliding the application interface a preset distance, wherein a ratio of the preset distance to a current screen height is within a preset range.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the control positioning method according to any one of claims 1 to 3 are implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the control positioning method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Web automation testing method and electronic device
CN107239397A
Popup window processing method and device for automated case test, equipment and storage medium
CN111258914A
