Element testing method and related device
By determining and intercepting the image of the area where the element is located in split-screen mode and determining the element position, the problem of low element positioning efficiency in the automated test of the mobile user interface is solved, and more efficient element testing is achieved.
Patent Information
- Application Number
- CN202411504407.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-26
- Publication Date
- 2025-03-25
AI Technical Summary
In the mobile user interface automation test, it is difficult for the prior art to efficiently locate elements that do not define the identity identification number id, especially when multiple similar elements exist, resulting in low recognition efficiency and high time-consuming execution of business automation.
By determining the display area where the element to be tested is located in the split screen mode, the picture of the area is intercepted, and the position of the element to be tested is determined through picture processing, and then the test is carried out based on the position.
It improves the efficiency of the test system to position elements in the UI, thereby improving the efficiency of element testing, reducing manual intervention and identification errors.
Smart Images

Figure CN119690818A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automated testing technology, and in particular to an element testing method and related devices. Background Art
[0002] In the process of automated testing of the mobile user interface (UI), it is necessary to simulate the user's operation on the elements in the application's page to be tested. Before simulating the user's test operation on the elements in the application's page to be tested, the elements need to be located first.
[0003] In the prior art, for elements that do not have a defined identity identification number ID and are difficult to locate using the element positioning method, OCR technology is usually used for element recognition. However, if there are multiple similar elements on a desktop, multiple element results will be identified, requiring manual intervention to check and label the serial numbers, which is time-consuming and has low efficiency in element recognition, thereby causing the business automation execution process to be time-consuming and inefficient. Summary of the invention
[0004] In view of this, the present application provides an element testing method and related devices, which first determine the display area where the element to be tested is located in the split-screen mode, then capture a picture of the display area, process the picture to determine the position of the element to be tested, and then perform testing based on the determined position to ensure successful element positioning, thereby improving the efficiency of the test system in locating elements in the UI, and thereby improving the efficiency of the test system in performing element testing.
[0005] In a first aspect, an embodiment of the present application provides an element testing method, which is applied to an electronic device, and the method includes:
[0006] Obtain a test request for a target element in the current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element;
[0007] When the display mode of the current device is a split-screen mode, determining a first area in the current interface corresponding to the target application identifier;
[0008] Performing a picture interception operation on the first area to obtain a target picture;
[0009] Acquire target position coordinates, where the target position coordinates refer to the position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information;
[0010] Performing a test operation on the target element according to the target position coordinates to obtain test data of the target element;
[0011] A test report of the target element is created according to the test data.
[0012] In a second aspect, an embodiment of the present application provides an element testing device, which is applied to electronic equipment, and the device includes:
[0013] A first acquisition unit is used to acquire a test request for a target element in a current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element;
[0014] A determination unit, configured to determine, when the display mode of the current device is a split-screen mode, a first area in the current interface corresponding to the target application identifier;
[0015] A second acquisition unit, configured to perform a picture interception operation on the first area to obtain a target picture;
[0016] a third acquisition unit, configured to acquire target position coordinates, wherein the target position coordinates refer to position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information;
[0017] A testing unit, used to perform a testing operation on the target element according to the target position coordinates to obtain test data of the target element;
[0018] A test report creating unit is used to create a test report of the target element according to the test data.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0022] It can be seen that through the above-mentioned element testing method and related devices, firstly, a test request for the target element in the current interface is obtained, and the test request carries the target application identifier and the first element information. The target application identifier is used to indicate the target application to which the target element belongs, and the first element information is used to characterize the element characteristics of the target element. Then, when the display mode of the current device is split-screen mode, the first area corresponding to the target application identifier in the current interface is determined, and then the image capture operation is performed on the first area to obtain the target image. Then, the target position coordinates of the target element in the current interface are obtained. The target position coordinates are determined according to the target image and the first element information. Then, the test operation for the target element is performed according to the target position coordinates to obtain the test data, and finally a test report for the target element is created according to the test data. By first determining the display area where the element to be tested is located in the split-screen mode, and then capturing the image of the display area, the position of the element to be tested is determined by processing the image, and then the test is performed based on the determined position, so as to ensure that the element positioning is successful, and improve the efficiency of the test system for element positioning in the UI, thereby improving the efficiency of the test system for element testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0024] Figure 1 A system architecture diagram of a test system provided in an embodiment of the present application;
[0025] Figure 2 A schematic diagram of a process for an element testing method provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of a flow chart of an element positioning method provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of a process flow of another element positioning method provided in an embodiment of the present application;
[0028] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0029] Figure 6 A block diagram of the functional units of an element testing device provided in an embodiment of the present application;
[0030] Figure 7 A block diagram of the functional units of another element testing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0033] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship. The "plurality" appearing in the embodiments of the present application refers to two or more.
[0034] In the embodiments of the present application, "at least one item" or similar expressions refer to any combination of these items, including any combination of single items or plural items, and refer to one or more, and multiple refers to two or more. For example, at least one item of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.
[0035] The "connection" that appears in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and the embodiments of the present application do not impose any limitations on this.
[0036] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0037] The following describes the relevant contents, technical solutions, beneficial effects, etc. involved in the embodiments of the present application.
[0038] First, the application scenarios, test systems, electronic devices, and server examples involved in the embodiments of the present application are described.
[0039] The embodiments of the present application can be applied to the following application scenarios, including but not limited to: a processing system with application testing function deployed on a server, for UI functional testing of electronic products or applications on different platforms (including system applications and / or third-party applications), for application development, application version upgrades, or other situations where UI testing is required. The embodiments of the present application can be adjusted and improved according to the specific application environment, and are not specifically limited here.
[0040] See also Figure 1 , Figure 1 This is a system architecture diagram of a test system provided in an embodiment of the present application. Figure 1 As shown, the test system 100 includes a server 101 and an electronic device 102, and the server 101 and the electronic device 102 are in communication connection, wherein the server 101 is installed with a test client. The electronic device 102 obtains a test request for a target element in the current interface, the test request carries an application identifier and first element information, the application identifier is used to indicate the target application to which the target element belongs, and the first element information is used to characterize the element characteristics of the target element; when the display mode of the current device is a split-screen mode, the first area corresponding to the application identifier in the current interface is determined; a picture capture operation is performed on the first area to obtain a target picture; the target position coordinates are obtained, the target position coordinates refer to the position coordinates of the target element in the current interface, the target position coordinates are determined according to the target picture and the first element information, and the target position coordinates are determined by the server 101 according to the target picture and the first element information; a test operation is performed on the target element according to the target position coordinates to obtain test data of the target element; and a test report of the target element is created according to the test data.
[0041] The server 101 of the present application can be a decentralized blockchain server, which is any node device in the blockchain. The characteristics of the blockchain are decentralization, openness and transparency, allowing each blockchain server to participate in database records, using cryptography and digital signatures to prove identity, authenticity and mandatory read / write access rights, and there is a mechanism to make it difficult to change historical records, and it can be easily detected that someone is trying to change it.
[0042] The electronic device 102 of the present application may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem with wireless communication functions, as well as various forms of user equipment (UE), mobile stations (MS), terminal devices, etc. The electronic device 102 may also be a network device, such as a base station, etc., without specific limitation.
[0043] The following is a detailed description of an element testing method in an embodiment of the present application. Figure 2 , Figure 2 A schematic diagram of a process for element testing provided in an embodiment of the present application. Figure 2 As shown, the element testing method specifically includes the following steps 201 to 206:
[0044] Step 201: Get a test request for a target element in the current interface.
[0045] In the embodiment of the present application, the interface refers to the screen interface of the electronic device running at least one application program displaying the function page of the at least one application program. The partition of the interface is associated with the display mode of the electronic device. The display mode of the electronic device includes a single screen mode and a split screen mode. The single screen mode means that the entire screen interface includes only one area, and the area displays the application page of an application. The split screen mode refers to dividing the screen interface into at least two areas, one area corresponds to one application, and different areas correspond to different applications, that is, one area displays the application page of one application, and different areas display the application pages of different applications. The area in the embodiment of the present application can also be called a display area. According to the number of split screens, the split screen mode can be n split screens, where n is an integer greater than or equal to 2, such as the split screen mode can be two split screens, three split screens, four split screens, etc. Taking the split screen mode as a three split screen as an example, if the screen interface includes three areas, area A, area B, and area C, the application page of application A is displayed in area A, the application page of application B is displayed in area B, and the application page of application C is displayed in area C. The application identifier of application A is identifier 1, the application identifier of application B is identifier 2, and the application identifier of application C is identifier 3. Then identifier 1 corresponds to area A, identifier 2 corresponds to area B, and identifier 3 corresponds to area C.
[0046] The target element refers to any element in the function page of the target application in the current interface.
[0047] Optionally, the test request may carry a target application identifier. The target application identifier is used to indicate the target application to which the target element belongs. In the embodiment of the present application, the application identifier is used to distinguish different applications. When registering an application, one application is assigned an application identifier, and different applications are assigned different application identifiers. Specifically, the application identifier may be an application name, an application identification number, etc. The application identification number may be an identification number composed of a registered application provider identifier and a dedicated application identifier extension. The application identification number may also be an application registration serial number. There is no specific limitation on the application identification number.
[0048] Optionally, the test request may carry first element information. The first element information is used to characterize the element features of the target element. In a specific implementation, the first element information may include at least one of the following: a first element identifier, first character information, and first image information. The first element identifier is used to characterize the element type of the target element. The element types include character elements and non-character elements. The character elements refer to elements whose element contents only include characters. The non-character elements refer to elements whose element contents include graphics. The first character information is used to characterize the character content of the target element. The first image information is used to characterize the image content of the target element.
[0049] Step 202: When the display mode of the current device is a split-screen mode, determine a first area in the current interface corresponding to the target application identifier.
[0050] Exemplarily, if the display mode of the current device is split-screen mode, the current interface includes area A and area B, area A displays the page of application A, and area B displays the page of application B. The application identifier of application A is identifier 1, and the application identifier of application B is identifier 2. If the target application identifier is identifier 1, then area A corresponding to identifier 1 is determined.
[0051] Exemplarily, if the display mode of the current device is split-screen mode, the current interface includes area A, area B, and area C, area A displays the page of application A, area B displays the page of application B, and area C displays the page of application C. The application identifier of application A is identifier 1, the application identifier of application B is identifier 2, and the application identifier of application C is identifier 3. If the target application identifier is identifier 3, then area C corresponding to identifier 3 is determined.
[0052] Step 203: perform a picture capture operation on the first area to obtain a target picture.
[0053] The electronic device can completely capture the picture in the first area to obtain the target picture.
[0054] Step 204: Obtain target position coordinates.
[0055] The target position coordinates refer to the position coordinates of the target element in the current interface, and are determined based on the target image and the first element information.
[0056] Optionally, the target position coordinates may be determined by the electronic device itself based on the target image and the first element information.
[0057] Optionally, the target position coordinates may also be determined by the server based on the target image and the first element information. In this case, after the electronic device obtains the target image and the first element information, it can generate an element positioning request based on the target image and the first element information, and then send the element positioning request to the server. After receiving the element positioning request, the server determines the target position coordinates based on the target image and the first element information, and sends the determined target position coordinates to the electronic device.
[0058] Step 205: Perform a test operation on the target element according to the target position coordinates to obtain test data of the target element.
[0059] Among them, if the test operation of the target element is a single click operation, then a single click operation is performed on the above target element; if the test operation of the target element is a double-click operation and the time interval between the double-click operations is less than a preset interval, then the target element is clicked twice in a row within the preset interval; if the test operation of the target element is a touch duration exceeding a first duration, then the touch target element exceeds the first duration, and the test operation of the target element is not specifically limited. The aforementioned preset interval can be 0.5 seconds, 1 second, etc., without specific limitation. The aforementioned first duration can be 2 seconds, 3 seconds, etc., without specific limitation.
[0060] For example, if the test operation of element A is a single click operation on element A, when the target element is element A, then a single click operation is performed on element A; if the test operation of element B is a long press of element B for 3 seconds, when the target element is element B, then element B is long press for 3 seconds.
[0061] Step 206: Create a test report for the target element according to the test data.
[0062] For a possible example, see Figure 3 , Figure 3 A schematic diagram of a flow chart of an element positioning method provided in an embodiment of the present application, such as Figure 3 As shown, the element positioning method is to determine the target position coordinates according to the above target image and the above first element information, which may include but is not limited to the following steps A1 to A5:
[0063] Step A1: determine the element type of the target element according to the first element information.
[0064] In the embodiment of the present application, the element identifier is used to indicate the element type.
[0065] Among them, the first element information may include at least one of the following: a first element identifier, first character information, and first image information. The first element identifier is used to characterize the element type of the target element. The element type includes character elements and non-character elements. Character elements refer to elements whose element content only includes characters, and non-character elements refer to elements whose element content includes graphics. The first character information is used to characterize the character content of the target element, and the first image information is used to characterize the image content of the target element.
[0066] For any element, when generating the element information of the element, the element type of the element can be obtained first, and then the element identifier that matches the determined element type can be obtained, and finally the element information of the element can be generated based on the obtained element identifier, so that the element information of the element carries the element identifier of the element. Among them, the element type of the generated element information can be manually determined and uploaded, the element type of the generated element information can also be determined based on the image of the element, and the element type of the generated element information can also be determined by other feasible methods, and the method for determining the element type is not specifically limited. Obviously, when it is necessary to test the element, the element type can be determined based on the element identifier in the element information. The correspondence between the element identifier and the element type is set in advance. For example, the element identifier of the character element is set to identifier 4, and the element identifier of the non-character element is set to identifier 5, then identifier 4 can represent the element type as a character element, and identifier 5 can represent the element type as a non-character element.
[0067] In one possible example, the first image information may include a first reference image, and determining the element type of the target element based on the first element information may include: performing image recognition on the first reference image to obtain a second result; if the second result only includes characters, determining that the target element is a character element; if the second result includes graphics, determining that the target element is a non-character element.
[0068] Among them, a character is the smallest unit of information representation used in computer and telecommunication technology, and a character may include letters, numbers, punctuation marks, etc.
[0069] It can be seen that in this example, the element type of the target element can be determined by performing image recognition on the reference image of the target element. When it is determined that the reference image only includes characters, the target element is determined to be a character element. When it is determined that the reference image only includes graphics, the target element is determined to be a non-character element, thereby ensuring the convenience and intelligence of determining the element type of the target element.
[0070] In one possible example, the first element information may include a first element identifier, and the above-mentioned determination of the element type of the above-mentioned target element based on the above-mentioned first element information includes: if the first element identifier is the second element identifier, the target element is determined to be a character element, and the second element identifier is used to characterize the element type as a character element; if the first element identifier is the third element identifier, the target element is determined to be a non-character element, and the aforementioned third element identifier is used to characterize the element type as the above-mentioned non-character element.
[0071] The second element identifier is different from the third element identifier, the second element identifier corresponds to a character element, and the third element identifier corresponds to a non-character element.
[0072] Exemplarily, the element identifier of the character element is identifier 4, and the element identifier of the non-character element is identifier 5. If the first element identifier is identifier 4, the target element is determined to be a character element, and if the first element identifier is identifier 5, the target element is determined to be a non-character element.
[0073] It can be seen that in this example, based on obtaining the type identifier of the target element, the element type of the corresponding target element can be directly determined based on the type identifier, thereby ensuring the convenience and flexibility of determining the element type of the target element.
[0074] Step A2: If the target element is the character element, perform text recognition on the target image to obtain a first result.
[0075] Step A3: If the first result includes a first element, determine the first position coordinates of the first element as the target position coordinates.
[0076] The first element is an element whose character information matches the first character information. If the similarity between the two elements is greater than the similarity threshold, the character information of the two elements matches. Otherwise, the character information of the two elements matches, and the similarity between the two elements must be greater than the similarity threshold.
[0077] Step A4: If the first result includes at least two of the first elements, obtain the first associated object information of the target element.
[0078] For any function page of any application, if a certain element has more than one similar element with a similarity greater than a similarity threshold value, a reference element can be configured for each of the element and its similar elements, and the element and its similar elements can be distinguished by their respective reference elements.
[0079] Among them, the above-mentioned first associated object information is used to characterize the first reference element associated with the above-mentioned target element, the above-mentioned first associated object information includes second element information and a first position constraint condition, the above-mentioned second element information is used to characterize the element characteristics of the above-mentioned first reference element, the above-mentioned second element information includes second character information, the above-mentioned second character information is used to characterize the character content of the above-mentioned first reference element, and the above-mentioned first position constraint condition is used to characterize the relative position relationship between the above-mentioned first reference element and the above-mentioned target element.
[0080] In a possible example, the first position constraint includes the first distance being the second distance, and the first angle being the second angle, the first distance being the straight-line distance between the first reference element and the target element, the first angle being the minimum angle in the clockwise direction from the extension line of the fifth line segment to the extension line of the sixth line segment, the fifth line segment being the straight-line segment between the target element and the first reference element, the sixth line segment being the straight-line segment between the second reference object and the first reference element, and the second reference object including one of the four vertices of the target image.
[0081] Step A5: According to the first associated object information, sequentially perform the following operations from step A51 to step A53 for each of the at least two first elements until the target position coordinates are determined:
[0082] Step A51: Determine the third element according to the second position coordinates of the second element currently being processed and the first position constraint condition.
[0083] The relative position relationship between the second element and the third element satisfies the first position constraint. The method of determining the third element based on the second position coordinates of the second element currently being processed and the first position constraint comprises: connecting the second element and the second reference object to obtain a seventh line segment; determining a first circular boundary based on the first position coordinates of the second element and the second distance, wherein the first circular boundary refers to a circular boundary with the first position coordinates as the center and the second distance as the radius; determining the third element on the first circular boundary based on the second angle, wherein the minimum angle in the clockwise direction from the extension line of the seventh line segment to the extension line of the eighth line segment is the second angle, and the seventh line segment is a straight line segment from the third element to the second element.
[0084] Step A52: If the third character information of the third element matches the second character information, then determine the second position coordinates as the target position coordinates.
[0085] Step A53: If the third character information does not match the second character information, determine that the second position coordinates are not the target position coordinates.
[0086] The following example illustrates the process of determining the target position coordinates when the target element is a character element.
[0087] Example 1: Assuming that the target element is element Y1, the target image is recognized. If the recognition result includes the three first elements of element Y1, the first reference element associated with element Y1 is element Y2, element Y2 is a character element, and the character information of element Y2 is character information z1, and the position between element Y1 and element Y2 satisfies the position constraint T1, then the pre-acquired associated object information of element Y1 includes character information z1 and position constraint T1. Assuming that the three first elements are element Y3, element Y4, and element Y5, the position coordinates of element Y3 in the current interface are position 1, the position coordinates of element Y4 in the current interface are position 2, and the position coordinates of element Y5 in the current interface are position 3, the corresponding element Y6 can be determined based on position 1 and position constraint T1, and the position constraint T1 is satisfied between element Y6 and element Y3. If the character information of element Y6 matches the character information z1, position 1 is determined to be the above-mentioned target position coordinates. If the character information of element Y6 does not match the character information z1, it is determined that position 1 is not the above-mentioned target position coordinates, and further based on position 2 of element Y4 and position constraint condition T1, the corresponding element Y7 is determined, and the position constraint condition T1 is satisfied between element Y7 and element Y4. If the character information of element Y7 matches the character information z1, it is determined that position 2 is not the above-mentioned target position coordinates. If the character information of element Y7 does not match the character information z1, it is determined that position 2 is not the above-mentioned target position coordinates, and further based on position 3 of element Y5 and position constraint condition T1, the corresponding element Y8 is determined, and the position constraint condition T1 is satisfied between element Y8 and element Y5. The character information of element Y8 matches the character information z1, and position 3 is determined to be the above-mentioned target position coordinates. In addition, after determining that position 2 is not the above-mentioned target position coordinates, position 3 can be directly determined to be the above-mentioned target position coordinates. Because after determining that position 2 is not the above-mentioned target position coordinate, only element Y5 remains unprocessed, and the character information of the third element corresponding to other elements does not match the character information z1. Obviously, the character information of the third element corresponding to element Y5 matches the character information z1. Obviously, position 3 is the above-mentioned target position coordinate.
[0088] Example 2: Assuming that the target element is element Y1, the target image is recognized. If the recognition result includes a first element that only includes element Y1, and the first element is element Y2, the position coordinates of element Y2 in the current interface are determined to be the above-mentioned target position coordinates.
[0089] It can be seen that in this example, when the element to be tested is a character element, text recognition is directly performed on the target image. If an element that matches the character information and the first character information is determined, the position coordinates of the element are directly determined as the target position coordinates. If multiple elements that match the character information and the first character information are determined, the target position is determined based on the first reference element associated with the target element, thereby improving the convenience and efficiency of locating the target element.
[0090] For a possible example, see Figure 4 , Figure 4 A flow chart of another element positioning method provided in an embodiment of the present application, such as Figure 4 As shown, the element positioning method is to determine the target position coordinates according to the above target image and the above first element information, which may include but is not limited to the following steps B1 to B5:
[0091] Step B1: determine the element type of the target element according to the first element information.
[0092] The processing process of step B1 is the same as that of the aforementioned step A1. Please refer to the description of the aforementioned step A1 and will not be repeated here.
[0093] Step B2: If the target element is the non-character element, obtain the second associated object information of the target element.
[0094] Among them, the above-mentioned second associated object information includes third element information and second position constraint conditions, the above-mentioned second associated object information is used to characterize the second reference element associated with the above-mentioned target element, the above-mentioned third element information includes at least one of the following: a fourth identifier, a fourth character information, and second image information, the above-mentioned third element information is used to characterize that the above-mentioned second reference element is a character element, and the above-mentioned second position constraint conditions are used to characterize the relative position relationship between the above-mentioned second reference element and the above-mentioned target element.
[0095] The second reference element of the target element is pre-set, and before setting the second reference element, it is determined that there is only one element in the target image whose similarity with the second reference element is higher than the similarity domain value. Based on this, the fourth identifier of the second reference element can be pre-set as the second element identifier. When the second reference element is located, the second reference element can be determined to be a character element based on the fourth identifier. The fourth character information of the second reference element can also be obtained in advance. Obviously, the fourth character information is used to characterize the character content of the second reference element. When the second reference element is located, the second reference element can be determined to be a character element based on the fourth character information. The second image information of the second reference element can also be obtained in advance. Based on the image content used to characterize the second reference element, when the second reference element is located, the second reference element can be determined to be a character element based on the second image information.
[0096] Step B3: Determine that the second reference element is a character element according to the second associated object information.
[0097] Step B4: Determine the fourth element included in the first result.
[0098] The fourth element refers to an element whose character information matches the fourth character information.
[0099] Step B5: Determine the target position coordinates according to the first position coordinates of the fourth element and the second position constraint condition.
[0100] It can be seen that in this example, when the element to be tested is a non-character element, the fourth element whose character information in the target image matches the character information of the second reference element of the element to be tested is first identified, and the second reference element is a character element. Then, based on the position coordinates of the fourth element and the position constraint between the element to be tested and its second reference element, the element to be tested of the element to be tested is determined. In this scenario, the second reference element associated with the element to be tested is first identified, and then the position of the element to be tested is determined based on the position of the second reference element and the position constraint between the two. This can quickly locate the position of the target element and improve the efficiency of element positioning.
[0101] It should be noted that, in the present application, when the element to be tested is a character element, the above Figure 3 The element positioning method shown is used to position the element. When the element to be tested is a non-character element, the above Figure 4 The element positioning method shown is used to position the elements, ensuring that all elements can be positioned successfully, thereby improving the efficiency and comprehensiveness of element positioning.
[0102] In a possible example, the second position constraint condition includes that the target distance is a reference distance, and the target angle is a reference angle, the target distance is a straight-line distance between the second reference element and the target element, the target angle is a minimum angle in a clockwise direction from an extension line of the first line segment to an extension line of the second line segment, the first line segment is a straight-line segment between the target element and the second reference element, the second line segment is a straight-line segment between the second reference object and the second reference element, the second reference object includes one of the four vertices of the target image, the second reference object and the first reference object may be the same object, or the second reference object and the first reference object may be different objects; according to The first position coordinates of the fourth element and the position constraint conditions are used to determine the target position coordinates, including: connecting the fourth element and the second reference object to obtain the third line segment; determining the target circular boundary according to the first position coordinates of the fourth element and the reference distance, the target circular boundary refers to a circular boundary with the first position coordinates as the center and the reference distance as the radius; determining the target object on the target circular boundary according to the reference angle, the minimum angle in the clockwise direction from the extension line of the third line segment to the extension line of the fourth line segment is the reference angle, and the fourth line segment is a straight line segment between the target object and the fourth element; and determining the position coordinates of the target object as the target position coordinates.
[0103] The following example illustrates the process of determining the target position coordinates when the target element is a non-character element.
[0104] Exemplarily, assuming that the target element is element Y9, the second reference element associated with element Y9 is element Y10, element Y10 is a character element, and the character information of element Y10 is character information z2, and the position between element Y1 and element Y10 satisfies the position constraint T2, then the pre-acquired associated object information of element Y9 includes character information z2 and position constraint T2. It is determined that the target element is a non-character element. If it is determined that the second reference element is a character element, the element Y11 whose character information matches the character information z2 in the target image can be determined first, and the target position coordinates can be determined based on the position coordinates of element Y11 in the current interface and the position constraint T2.
[0105] It can be seen that in this example, when the element to be tested is a non-character element, the second reference element associated with the element to be tested is first identified, and then the position of the element to be tested is determined based on the position of the second reference element, one of the four vertices of the target image, and the position constraint conditions satisfied by the element to be tested. The position of the target element can be accurately located, further improving the efficiency and accuracy of element positioning.
[0106] It can be seen that through the above-mentioned element testing method, firstly, a test request for the target element in the current interface is obtained, and the test request carries the target application identifier and the first element information. The target application identifier is used to indicate the target application to which the target element belongs, and the first element information is used to characterize the element characteristics of the target element. Then, when the display mode of the current device is split-screen mode, the first area corresponding to the target application identifier in the current interface is determined, and then the image capture operation is performed on the first area to obtain the target image. Then, the target position coordinates of the target element in the current interface are obtained. The target position coordinates are determined according to the target image and the first element information. Then, the test operation for the target element is performed according to the target position coordinates to obtain the test data, and finally a test report for the target element is created according to the test data. By first determining the display area where the element to be tested is located in the split-screen mode, and then capturing the image of the display area, the position of the element to be tested is determined by processing the image, and then the test is performed based on the determined position, so as to ensure that the element positioning is successful, and improve the efficiency of the test system for element positioning in the UI, and then improve the efficiency of the test system for element testing.
[0107] The steps not described in detail above can be found in Figure 2 The description of the steps of the method will not be repeated here.
[0108] Combine the following Figure 5 An electronic device in an embodiment of the present application is described. Figure 5 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application, wherein the electronic device 102 includes a processor 501 , a memory 502 , and a communication bus 503 for connecting the processor 501 and the memory 502 .
[0109] In some possible implementations, the memory 502 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or portable read-only memory (CD-ROM), and the memory 502 is used to store the program code executed by the electronic device 102 and the transmitted data.
[0110] In some possible implementations, the electronic device 102 further includes a communication interface for receiving and sending data.
[0111] In some possible implementations, the processor 501 may be one or more central processing units (CPUs). When the processor 501 is a central processing unit (CPU), the central processing unit (CPU) may be a single-core central processing unit (CPU) or a multi-core central processing unit (CPU).
[0112] In some possible implementations, the processor 501 may be a baseband chip, a chip, a central processing unit (CPU), a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof.
[0113] In a specific implementation, the processor 501 in the electronic device 102 is used to execute the computer program or instruction 521 stored in the memory 502 to perform the following operations:
[0114] Obtain a test request for a target element in the current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element;
[0115] When the display mode of the current device is a split-screen mode, determining a first area corresponding to the application identifier in the current interface;
[0116] Performing a picture interception operation on the first area to obtain a target picture;
[0117] Obtaining target position coordinates, where the target position coordinates refer to the position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information;
[0118] Performing a test operation on the target element according to the target position coordinates to obtain test data of the target element;
[0119] A test report for the target element is created based on the test data.
[0120] It should be noted that the specific implementation of each operation can adopt the corresponding description of the method embodiment shown above, and the electronic device 102 can be used to execute the above method embodiment of the present application, which will not be repeated here.
[0121] In a possible example, the first element information includes at least one of the following: a first element identifier, first character information, and first image information. The first element identifier is used to characterize the element type of the target element. The element type includes character elements and non-character elements. The character element refers to an element whose element content only includes characters, and the non-character element refers to an element whose element content includes graphics. The first character information is used to characterize the character content of the target element, and the first image information is used to characterize the image content of the target element.
[0122] In a possible example, the step of determining the target position coordinates according to the target image and the first element information includes: determining the element type of the target element according to the first element information; if the target element is the character element, performing text recognition on the target image to obtain a first result; if the first result includes a first element, determining the first position coordinates of the first element as the target position coordinates, the first element refers to an element whose character information matches the first character information; if the first result includes at least two of the first elements, obtaining the first associated object information of the target element, the first associated object information being used to characterize a first reference element associated with the target element, the first associated object information including second element information and a first position constraint, the second element information being used to characterize an element feature of the first reference element, The second element information includes second character information, the second character information is used to represent the character content of the first reference element, and the first position constraint is used to represent the relative position relationship between the first reference element and the target element; according to the first associated object information, the following operations are performed in turn for each first element of at least two of the first elements until the target position coordinates are determined: according to the second position coordinates of the second element currently being processed and the first position constraint, a third element is determined, and the relative position relationship between the second element and the third element satisfies the first position constraint; if the third character information of the third element matches the second character information, the second position coordinates are determined to be the target position coordinates; if the third character information does not match the second character information, the second position coordinates are determined not to be the target position coordinates.
[0123] In a possible example, the first image information includes a first reference image, and determining the element type of the target element according to the first element information includes: performing image recognition on the first reference image to obtain a second result;
[0124] If the second result includes only characters, the target element is determined to be the character element; if the second result includes graphics, the target element is determined to be the non-character element.
[0125] In one possible example, the first element information includes the first element identifier, and determining the element type of the target element based on the first element information includes: if the first element identifier is the second element identifier, determining that the target element is the character element, and the second element identifier is used to characterize that the element type is the character element; if the first element identifier is the third element identifier, determining that the target element is the non-character element, and the third element identifier is used to characterize that the element type is the non-character element.
[0126] In a possible example, after determining the element type of the target element according to the first element information, the method further includes: if the target element is the non-character element, obtaining second associated object information of the target element, the second associated object information including third element information and second position constraint conditions, the second associated object information being used to characterize a second reference element associated with the target element, the third element information including at least one of the following: a fourth identifier, fourth character information, and second image information, the third element information being used to characterize that the second reference element is a character element, and the second position constraint condition being used to characterize the relative position relationship between the second reference element and the target element; determining that the second reference element is a character element according to the second associated object information; determining the fourth element included in the first result, the fourth element being an element whose character information matches the fourth character information; and determining the target position coordinates according to the first position coordinates of the fourth element and the second position constraint conditions.
[0127] In a possible example, the second position constraint includes that the target distance is a reference distance, and the target angle is a reference angle, the target distance is a straight-line distance between the second reference element and the target element, the target angle is a minimum angle in a clockwise direction from an extension line of the first line segment to an extension line of the second line segment, the first line segment is a straight line segment between the target element and the second reference element, the second line segment is a straight line segment between a reference object and the second reference element, and the reference object includes one of four vertices of the target image; the determination of the fourth element according to the first position coordinates and the position constraint The target position coordinates include: connecting the fourth element and the reference object to obtain the third line segment; determining a target circular boundary according to the first position coordinates of the fourth element and the reference distance, wherein the target circular boundary refers to a circular boundary with the first position coordinates as the center and the reference distance as the radius; determining a target object on the target circular boundary according to the reference angle, wherein the minimum angle in the clockwise direction from the extension line of the third line segment to the extension line of the fourth line segment is the reference angle, and the fourth line segment is a straight line segment between the target object and the fourth element; and determining the position coordinates of the target object as the target position coordinates.
[0128] In a possible example, the target location coordinates are determined by a server according to the target image and the first element information, and the server is communicatively connected to the electronic device.
[0129] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0130] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0131] In the case of dividing each functional module into corresponding functional modules, Figure 6 This is a functional unit composition block diagram of an element testing device provided in an embodiment of the present application. The element testing device 600 is applied to an electronic device, and the element testing device 600 includes:
[0132] A first acquisition unit 610 is used to acquire a test request for a target element in the current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element;
[0133] A determining unit 620, configured to determine a first area corresponding to the target application identifier in the current interface when the display mode of the current device is a split-screen mode;
[0134] A second acquisition unit 630 is used to perform a picture interception operation on the first area to obtain a target picture;
[0135] A third acquisition unit 640 is used to acquire target position coordinates, where the target position coordinates refer to position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information;
[0136] A testing unit 650, configured to perform a testing operation on the target element according to the target position coordinates to obtain test data of the target element;
[0137] The test report creating unit 660 is used to create a test report of the target element according to the test data.
[0138] It can be seen that, through the above-mentioned element testing device, firstly, a test request for the target element in the current interface is obtained, and the test request carries the target application identifier and the first element information. The target application identifier is used to indicate the target application to which the target element belongs, and the first element information is used to characterize the element characteristics of the target element. Then, when the display mode of the current device is split-screen mode, the first area corresponding to the target application identifier in the current interface is determined, and then the image capture operation is performed on the first area to obtain the target image. Then, the target position coordinates of the target element in the current interface are obtained. The target position coordinates are determined according to the target image and the first element information. Then, the test operation for the target element is performed according to the target position coordinates to obtain the test data, and finally a test report for the target element is created according to the test data. By first determining the display area where the element to be tested is located in the split-screen mode, and then capturing the image of the display area, the position of the element to be tested is determined by processing the image, and then the test is performed based on the determined position, so as to ensure that the element positioning is successful, and improve the efficiency of the test system for element positioning in the UI, and then improve the efficiency of the test system for element testing.
[0139] In a possible example, the first element information includes at least one of the following: a first element identifier, first character information, and first image information. The first element identifier is used to characterize the element type of the target element. The element type includes character elements and non-character elements. The character element refers to an element whose element content only includes characters, and the non-character element refers to an element whose element content includes graphics. The first character information is used to characterize the character content of the target element, and the first image information is used to characterize the image content of the target element.
[0140] In a possible example, the step of determining the target position coordinates according to the target image and the first element information includes: determining the element type of the target element according to the first element information; if the target element is the character element, performing text recognition on the target image to obtain a first result; if the first result includes a first element, determining the first position coordinates of the first element as the target position coordinates, the first element refers to an element whose character information matches the first character information; if the first result includes at least two of the first elements, obtaining the first associated object information of the target element, the first associated object information being used to characterize a first reference element associated with the target element, the first associated object information including second element information and a first position constraint, the second element information being used to characterize an element feature of the first reference element, The second element information includes second character information, the second character information is used to represent the character content of the first reference element, and the first position constraint is used to represent the relative position relationship between the first reference element and the target element; according to the first associated object information, the following operations are performed in turn for each first element of at least two of the first elements until the target position coordinates are determined: according to the second position coordinates of the second element currently being processed and the first position constraint, a third element is determined, and the relative position relationship between the second element and the third element satisfies the first position constraint; if the third character information of the third element matches the second character information, the second position coordinates are determined to be the target position coordinates; if the third character information does not match the second character information, the second position coordinates are determined not to be the target position coordinates.
[0141] In a possible example, the first image information includes a first reference image, and determining the element type of the target element according to the first element information includes: performing image recognition on the first reference image to obtain a second result;
[0142] If the second result includes only characters, the target element is determined to be the character element; if the second result includes graphics, the target element is determined to be the non-character element.
[0143] In one possible example, the first element information includes the first element identifier, and determining the element type of the target element based on the first element information includes: if the first element identifier is the second element identifier, determining that the target element is the character element, and the second element identifier is used to characterize that the element type is the character element; if the first element identifier is the third element identifier, determining that the target element is the non-character element, and the third element identifier is used to characterize that the element type is the non-character element.
[0144] In a possible example, after determining the element type of the target element according to the first element information, the method further includes: if the target element is the non-character element, obtaining second associated object information of the target element, the second associated object information including third element information and second position constraint conditions, the second associated object information being used to characterize a second reference element associated with the target element, the third element information including at least one of the following: a fourth identifier, fourth character information, and second image information, the third element information being used to characterize that the second reference element is a character element, and the second position constraint condition being used to characterize the relative position relationship between the second reference element and the target element; determining that the second reference element is a character element according to the second associated object information; determining the fourth element included in the first result, the fourth element being an element whose character information matches the fourth character information; and determining the target position coordinates according to the first position coordinates of the fourth element and the second position constraint conditions.
[0145] In a possible example, the second position constraint includes that the target distance is a reference distance, and the target angle is a reference angle, the target distance is a straight-line distance between the second reference element and the target element, the target angle is a minimum angle in a clockwise direction from an extension line of the first line segment to an extension line of the second line segment, the first line segment is a straight line segment between the target element and the second reference element, the second line segment is a straight line segment between a reference object and the second reference element, and the reference object includes one of four vertices of the target image; the determination of the fourth element according to the first position coordinates and the position constraint The target position coordinates include: connecting the fourth element and the reference object to obtain the third line segment; determining a target circular boundary according to the first position coordinates of the fourth element and the reference distance, wherein the target circular boundary refers to a circular boundary with the first position coordinates as the center and the reference distance as the radius; determining a target object on the target circular boundary according to the reference angle, wherein the minimum angle in the clockwise direction from the extension line of the third line segment to the extension line of the fourth line segment is the reference angle, and the fourth line segment is a straight line segment between the target object and the fourth element; and determining the position coordinates of the target object as the target position coordinates.
[0146] In a possible example, the target location coordinates are determined by a server according to the target image and the first element information, and the server is communicatively connected to the electronic device.
[0147] It should be noted that the specific implementation of each operation can adopt the corresponding description of the method embodiment shown above, and the element testing device 600 can be used to execute the above method embodiment of the present application, which will not be described in detail.
[0148] In the case of an integrated unit, the following combination Figure 7 Another element testing device 700 in an embodiment of the present application is described in detail. The element testing device 700 is applied to an electronic device. The element testing device 700 includes a processing unit 701 and a communication unit 702, wherein the processing unit 701 is used to execute any step in the above method embodiment, and when performing data transmission, the communication unit 702 can be selectively called to complete the corresponding operation.
[0149] The element testing device 700 may further include a storage unit 703 for storing program codes and data. The processing unit 701 may be a processor, the communication unit 702 may be a wireless communication module, and the storage unit 703 may be a memory.
[0150] The processing unit 701 is specifically used to: obtain a test request for a target element in the current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element;
[0151] When the display mode of the current device is a split-screen mode, determining a first area corresponding to the application identifier in the current interface;
[0152] Performing a picture interception operation on the first area to obtain a target picture;
[0153] Acquire target position coordinates, where the target position coordinates refer to the position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information;
[0154] Performing a test operation on the target element according to the target position coordinates to obtain test data of the target element;
[0155] A test report of the target element is created according to the test data.
[0156] It can be seen that, through the above-mentioned element testing device, firstly, a test request for the target element in the current interface is obtained, and the test request carries the target application identifier and the first element information. The target application identifier is used to indicate the target application to which the target element belongs, and the first element information is used to characterize the element characteristics of the target element. Then, when the display mode of the current device is split-screen mode, the first area corresponding to the target application identifier in the current interface is determined, and then the image capture operation is performed on the first area to obtain the target image. Then, the target position coordinates of the target element in the current interface are obtained. The target position coordinates are determined according to the target image and the first element information. Then, the test operation for the target element is performed according to the target position coordinates to obtain the test data, and finally a test report for the target element is created according to the test data. By first determining the display area where the element to be tested is located in the split-screen mode, and then capturing the image of the display area, the position of the element to be tested is determined by processing the image, and then the test is performed based on the determined position, so as to ensure that the element positioning is successful, and improve the efficiency of the test system for element positioning in the UI, and then improve the efficiency of the test system for element testing.
[0157] It should be noted that the specific implementation of each operation can adopt the corresponding description of the method embodiment shown above, and the element testing device 700 can be used to execute the above method embodiment of the present application, which will not be described in detail.
[0158] An embodiment of the present application also provides a chip, including a processor, a memory, and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps described in the above method embodiment.
[0159] An embodiment of the present application also provides a chip module, including a transceiver component and a chip, the chip including a processor, a memory and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps described in the above method embodiment.
[0160] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method recorded in the above method embodiment, and the above computer includes an electronic device.
[0161] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0162] It should be noted that, for the above-mentioned various embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required by the embodiments of the present application.
[0163] In the above embodiments, the embodiments of the present application have different focuses on the description of each embodiment. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0164] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM, flash memory, ROM, EPROM, electrically erasable programmable read-only memory (electrically EPROM, EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs) or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device or a management device. Of course, the processor and the storage medium can also be present in a terminal device or a management device as discrete components.
[0165] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server, or data center to another website site, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0166] The modules / units included in the devices and products described in the above embodiments may be software modules / units or hardware modules / units, or may be partially software modules / units and partially hardware modules / units. For example, for the devices and products applied to or integrated in the chip, the modules / units included therein may all be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for the devices and products applied to or integrated in the chip module, the modules / units included therein may all be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or in different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The software programs run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits. It is implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in hardware such as circuits.
[0167] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above description is only the specific implementation method of the embodiments of the present application and is not intended to limit the protection scope of the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.
Claims
1. An element testing method, characterized in that: Applied to electronic equipment, the method comprises: Obtain a test request for a target element in the current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element; When the display mode of the current device is a split-screen mode, determining a first area in the current interface corresponding to the target application identifier; Performing a picture interception operation on the first area to obtain a target picture; Acquire target position coordinates, where the target position coordinates refer to the position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information; Performing a test operation on the target element according to the target position coordinates to obtain test data of the target element; A test report of the target element is created according to the test data.
2. The method according to claim 1, characterized in that The first element information includes at least one of the following: a first element identifier, first character information, and first image information. The first element identifier is used to characterize the element type of the target element. The element type includes character elements and non-character elements. The character element refers to an element whose element content only includes characters, and the non-character element refers to an element whose element content includes graphics. The first character information is used to characterize the character content of the target element, and the first image information is used to characterize the image content of the target element.
3. The method according to claim 2, characterized in that The step of determining the target position coordinates according to the target image and the first element information includes: Determine the element type of the target element according to the first element information; If the target element is the character element, performing text recognition on the target image to obtain a first result; If the first result includes a first element, determining the first position coordinates of the first element as the target position coordinates, the first element being an element whose character information matches the first character information; If the first result includes at least two of the first elements, first associated object information of the target element is obtained, the first associated object information is used to characterize a first reference element associated with the target element, the first associated object information includes second element information and a first position constraint condition, the second element information is used to characterize an element feature of the first reference element, the second element information includes second character information, the second character information is used to characterize a character content of the first reference element, and the first position constraint condition is used to characterize a relative position relationship between the first reference element and the target element; According to the first associated object information, the following operations are performed in sequence for each of at least two of the first elements until the target position coordinates are determined: Determine a third element according to the second position coordinates of the second element currently being processed and the first position constraint condition, wherein a relative position relationship between the second element and the third element satisfies the first position constraint condition; If the third character information of the third element matches the second character information, determining the second position coordinates as the target position coordinates; If the third character information does not match the second character information, it is determined that the second position coordinates are not the target position coordinates.
4. The method according to claim 3, characterized in that The first image information includes a first reference image, and determining the element type of the target element according to the first element information includes: Performing image recognition on the first reference image to obtain a second result; If the second result includes only characters, determining that the target element is the character element; If the second result includes a graphic, the target element is determined to be the non-character element.
5. The method according to claim 3, characterized in that: The first element information includes the first element identifier, and determining the element type of the target element according to the first element information includes: If the first element identifier is the second element identifier, it is determined that the target element is the character element, and the second element identifier is used to indicate that the element type is the character element; If the first element identifier is the third element identifier, the target element is determined to be the non-character element, and the third element identifier is used to indicate that the element type is the non-character element.
6. The method according to any one of claims 3 to 5, characterized in that: After determining the element type of the target element according to the first element information, the method further includes: If the target element is the non-character element, obtaining second associated object information of the target element, the second associated object information including third element information and second position constraint conditions, the second associated object information is used to characterize a second reference element associated with the target element, the third element information includes at least one of the following: a fourth identifier, fourth character information, and second image information, the third element information is used to characterize that the second reference element is a character element, and the second position constraint conditions are used to characterize a relative position relationship between the second reference element and the target element; Determining, according to the second associated object information, that the second reference element is a character element; determining a fourth element included in the first result, wherein the fourth element refers to an element whose character information matches the fourth character information; The target position coordinates are determined according to the first position coordinates of the fourth element and the second position constraint condition.
7. The method according to claim 6, characterized in that The second position constraint condition includes that the target distance is a reference distance, and the target angle is a reference angle, the target distance is a straight-line distance between the second reference element and the target element, the target angle is a minimum angle from an extension line of a first line segment to an extension line of a second line segment in a clockwise direction, the first line segment is a straight-line segment between the target element and the second reference element, the second line segment is a straight-line segment between a reference object and the second reference element, and the reference object includes one of four vertices of the target image; The step of determining the target position coordinates according to the first position coordinates of the fourth element and the position constraint condition comprises: connecting the fourth element and the reference object to obtain the third line segment; determining a target circular boundary according to the first position coordinate of the fourth element and the reference distance, wherein the target circular boundary refers to a circular boundary with the first position coordinate as the center and the reference distance as the radius; The target object on the target circular boundary is determined according to the reference angle, the minimum angle between the extension line of the third line segment and the extension line of the fourth line segment in the clockwise direction is the reference angle, and the fourth line segment is the straight line segment from the target object to the fourth element; and the position coordinates of the target object are determined as the target position coordinates.
8. The method according to claim 1, characterized in that The target position coordinates are determined by a server according to the target image and the first element information, and the server is communicatively connected with the electronic device.
9. An element testing device, characterized in that: Applied to electronic equipment, the device comprises: A first acquisition unit is used to acquire a test request for a target element in a current interface, the test request carrying a target application identifier and first element information, the target application identifier is used to indicate a target application to which the target element belongs, and the first element information is used to characterize an element feature of the target element; A determination unit, configured to determine, when the display mode of the current device is a split-screen mode, a first area in the current interface corresponding to the target application identifier; A second acquisition unit, configured to perform a picture interception operation on the first area to obtain a target picture; a third acquisition unit, configured to acquire target position coordinates, wherein the target position coordinates refer to position coordinates of the target element in the current interface, and the target position coordinates are determined according to the target image and the first element information; A testing unit, used to perform a testing operation on the target element according to the target position coordinates to obtain test data of the target element; A test report creating unit is used to create a test report of the target element according to the test data.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store one or more programs and is configured to be executed by the processor, wherein the programs include instructions for executing the steps in the method according to any one of claims 1 to 8.