Element positioning method and element positioning device
Patent Information
- Application Number
- CN202211021270.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-24
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2042-08-24
AI Technical Summary
但,录制脚本均需要测试人员人工录制,耗时耗力,并且,可能会产生无效脚本,校验较为繁琐,具体为对脚本不断进行调试,一旦页面元素位置进行了调整,脚本便随之失效,仍无法解决测试效率低以及维护成本高的问题
[0032] This application's embodiments utilize the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determine the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without requiring testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development, without waiting for existing functions to be implemented, thus improving the efficiency of page launch.
Smart Images

Figure CN115203616B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an element positioning method and an element positioning device. Background Technology
[0002] In the process of automated testing of user interface (UI), obtaining page elements requires developers to query the element identifiers of the page one by one (such as element id / name / css / xpath / displayname, etc.), and manual debugging and accurate positioning are required, resulting in low development efficiency and testing efficiency. Once the position of elements on the page is adjusted, the script for element positioning needs to be modified accordingly, resulting in high maintenance costs.
[0003] The current solution involves using recording software to capture and store the identifiers of the page elements being manipulated. However, these scripts require manual recording by testers, which is time-consuming and labor-intensive. Furthermore, invalid scripts may be generated, and verification is quite cumbersome, requiring continuous debugging. Once the position of a page element is adjusted, the script becomes invalid, failing to address the issues of low testing efficiency and high maintenance costs. Summary of the Invention
[0004] The purpose of this application is to provide an element positioning method and an element positioning device that can automatically determine the target position of each target element on the page, thereby improving the testing efficiency of the user interface.
[0005] In a first aspect, embodiments of this application provide an element location method, including:
[0006] Determine the target logical name of the target element;
[0007] Based on the target logical name, retrieve the target call interface;
[0008] Using the target call interface, and based on the first mapping table between logical names and element identifiers, the target element identifier corresponding to the target logical name is determined; wherein, the logical name and element identifier of each element are unique.
[0009] Based on the target element identifier, the target position of the target element is determined.
[0010] In one possible implementation, the first mapping table is stored on a low-code platform or the first mapping table is stored in the target calling interface.
[0011] In one possible implementation, determining the target location of the target element based on the target element identifier includes:
[0012] Using the target call interface, based on the first mapping table and the second mapping table, the target title name corresponding to the target element identifier is determined, wherein the second mapping table includes a second mapping table between logical names and title names;
[0013] Determine the location of the target title name and use it as the target location of the target element.
[0014] In one possible implementation, the element location method further includes:
[0015] The logical names in the second mapping table correspond to one or more title names.
[0016] In one possible implementation, the element location method further includes:
[0017] Based on the target location, identify the page information corresponding to the target element in the page to which the target element belongs.
[0018] In one possible implementation, the element location method further includes:
[0019] According to the generation rules, a preset number of characters are used to generate the target element identifier of the target element, wherein the target element and the target element identifier are uniquely associated.
[0020] Secondly, embodiments of this application also provide an element positioning device, comprising:
[0021] The first determining module is configured to determine the target logical name of the target element;
[0022] The invocation module is configured to invoke the target call interface based on the target logical name;
[0023] The second determining module is configured to use the target calling interface to determine the target element identifier corresponding to the target logical name based on the first mapping relationship table between logical names and element identifiers; wherein, the logical name and element identifier of each element are unique;
[0024] The third determining module is configured to determine the target position of the target element based on the target element identifier.
[0025] In one possible implementation, the third determining module is specifically configured as follows:
[0026] Using the target call interface, based on the first mapping table and the second mapping table, the target title name corresponding to the target element identifier is determined, wherein the second mapping table includes a second mapping table between logical names and title names;
[0027] Determine the location of the target title name and use it as the target location of the target element.
[0028] In one possible implementation, the element positioning device further includes an identification module configured as follows:
[0029] Based on the target location, identify the page information corresponding to the target element in the page to which the target element belongs.
[0030] In one possible implementation, the element positioning device further includes a generation module configured as follows:
[0031] According to the generation rules, a preset number of characters are used to generate the target element identifier of the target element, wherein the target element and the target element identifier are uniquely associated.
[0032] This application's embodiments utilize the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determine the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without requiring testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development, without waiting for existing functions to be implemented, thus improving the efficiency of page launch. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 A flowchart of an element positioning method provided in this application is shown;
[0035] Figure 2 A schematic diagram of the structure of an element positioning device provided in this application is shown;
[0036] Figure 3 A schematic diagram of the structure of an electronic device provided in this application is shown. Detailed Implementation
[0037] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0038] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0039] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0040] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0041] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application, which have the features described in the claims and are therefore all within the scope of protection defined herein.
[0042] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0043] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0044] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0045] User interface testing (UI testing) is used to test whether the layout of the functional modules of the user interface is reasonable, whether the placement of various elements on the page conforms to user habits, and whether the placement of various elements on the page meets the requirements of convenient and easy-to-understand operation, etc. The element positioning method provided in this application is applied to UI testing on a low-code platform. This element positioning method can automatically determine the target position of each target element on the page, thereby improving the testing efficiency of the user interface. To facilitate understanding of this application, a detailed description of the element positioning method provided in this application is given first.
[0046] like Figure 1 The diagram shows a flowchart of an element positioning method provided in an embodiment of this application, wherein the specific steps include S101-S104.
[0047] S101, Determine the target logical name of the target element.
[0048] Here, the target element is the element whose position is to be determined. In a specific test, every element on the page can be used as the target element, thereby enabling the determination of the position of each element on the page.
[0049] As one example, when generating a page, the low-code platform includes the page's data, elements, and corresponding interfaces as attribute information. Therefore, for each target element, its target logical name can be determined. For instance, the target logical name for target element A, i.e., the Account Name of target element A, is yxc_account, etc.
[0050] S102, based on the target logical name, invoke the target call interface.
[0051] After determining the target logic name of the target element, the corresponding target API for that page is invoked. For pages on low-code platforms, one or more APIs can be configured, such as the API for Microsoft's next-generation customer relationship management system (Dynamics CRM).
[0052] Optionally, based on the determined target logical name, the page to which the target logical name belongs is further determined. Based on the pre-defined mapping relationship between pages and API calls, the target API call corresponding to the page to which the target logical name belongs is retrieved. The page to which each element belongs is pre-defined by the page developers. For example, each page corresponds to an element relationship table, which includes the logical names of all elements belonging to that page. Therefore, the page to which an element belongs can be found from each element relationship table based on its logical name.
[0053] S103, using the target call interface, determine the target element identifier corresponding to the target logical name based on the first mapping relationship table between logical names and element identifiers; wherein, the logical name and element identifier of each element are unique.
[0054] After determining the target calling interface, the target element identifier corresponding to the target logical name is determined using the target calling interface and based on the first mapping relationship table between logical names and element identifiers; wherein, the logical name and element identifier of each element are unique. Here, the first mapping relationship table can be stored on the low-code platform, or stored in the target calling interface, or stored in a storage area that has a calling relationship with the target calling interface, etc. This application embodiment does not make specific limitations in this regard, as long as the target calling interface can retrieve the first mapping relationship table.
[0055] This application embodiment also illustrates a method for generating a first mapping table. Specifically, according to a generation rule, a preset number of characters are used to generate target element identifiers for target elements. As one example, for a target element, both the target logical name and the target element identifier can be generated simultaneously, that is, key-value pairs of the target element can be generated. These key-value pairs include the target logical name and the target element identifier. For example, when generating key-value pairs of target elements, it can be as follows: "Account Name: <div id="id-a1542908-ce4b-47fe-8824-5275d06d2b4c-38"> In this context, Account Name is the target logical name of the target element, and id-a1542908-ce4b-47fe-8824-5275d06d2b4c-38 is the target element identifier. Each target element uniquely corresponds to its target element identifier. Alternatively, a target logical name and a target element identifier can be generated separately for each target element, and then key-value pairs can be generated based on these identifiers. This embodiment of the application does not impose specific limitations on this approach.
[0056] After generating the target logical name and target element identifier of the target element, a first mapping table is established. For example, this first mapping table is generated and stored simultaneously when generating the page on a low-code platform. Optionally, the target element identifier can also be stored in the page's attribute information. For example, the mapping relationship between the page, element, logical name, and element identifier can be represented in the form "Form.ui.filed.accountname.domId="id-a1542908-ce4b-47fe-8824-5275d06d2b4c-38"". Here, Form represents page information, ui represents graphic element information, field represents field information, account name represents logical name, and domId="id-a1542908-ce4b-47fe-8824-5275d06d2b4c-38" represents element identifier, etc.
[0057] After obtaining the first mapping table, the target element identifier can be encapsulated using logical names. As an example, the encapsulation can be accomplished using the logical code "Form.ui.GetDomId(filedName){return Form.ui.filed[filedName].domId}".
[0058] S104, Determine the target position of the target element based on the target element identifier.
[0059] After identifying the target element corresponding to the target logical name, when determining the target location of the target element, the target call interface is used to determine the target title name corresponding to the target element identifier based on the first mapping table and the second mapping table. The second mapping table includes a second mapping table between logical names and title names. The logical name in the second mapping table corresponds to one or more title names, which makes it easy to determine the logical name corresponding to the title name even if the title name changes.
[0060] Furthermore, the location of the target title name is determined using the target call interface and used as the target position of the target element. Optionally, the location of the target title name is determined using XPath, where XPath is a language used to determine the location of a part of an XML document, a subset of Standard Generalized Markup Language. XPath is based on the tree structure of XML, meaning it has different types of nodes, including element nodes, attribute nodes, and text nodes, providing the ability to find nodes in the data structure tree, thereby achieving the purpose of location. Of course, the embodiments of this application are not limited to this; any method that can achieve element location is acceptable.
[0061] In other words, this application embodiment utilizes the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determines the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without the need for testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development without waiting for existing functions to be implemented, thus improving the efficiency of page launch.
[0062] After locating the target element, based on the target location, the page information corresponding to the target element in the page to which the target element belongs is identified, thereby realizing the acquisition of page information and improving the accuracy of information acquisition.
[0063] Based on the same inventive concept, the second aspect of this application also provides an element positioning device corresponding to the element positioning method. Since the principle of solving the problem by the element positioning device in this application is similar to that of the element positioning method described above, the implementation of the element positioning device can refer to the implementation of the method, and the repeated parts will not be described again.
[0064] Figure 2 A schematic diagram of the element positioning device provided in an embodiment of this application is shown, specifically including:
[0065] The first determining module 201 is configured to determine the target logical name of the target element;
[0066] The invocation module 202 is configured to invoke the target call interface based on the target logical name;
[0067] The second determining module 203 is configured to use the target calling interface to determine the target element identifier corresponding to the target logical name based on the first mapping relationship table between logical names and element identifiers; wherein, the logical name and element identifier of each element are unique;
[0068] The third determining module 204 is configured to determine the target position of the target element based on the target element identifier.
[0069] In another embodiment, the first mapping table is stored on a low-code platform or the first mapping table is stored in the target calling interface.
[0070] In yet another embodiment, the third determining module 204 is specifically configured as follows:
[0071] Using the target call interface, based on the first mapping table and the second mapping table, the target title name corresponding to the target element identifier is determined, wherein the second mapping table includes a second mapping table between logical names and title names;
[0072] Determine the location of the target title name and use it as the target location of the target element.
[0073] In another embodiment, the logical names in the second mapping table correspond to one or more title names.
[0074] In yet another embodiment, the element positioning device further includes an identification module 205, which is configured as follows:
[0075] Based on the target location, identify the page information corresponding to the target element in the page to which the target element belongs.
[0076] In yet another embodiment, the element positioning device further includes a generation module 206, which is configured as follows:
[0077] According to the generation rules, a preset number of characters are used to generate the target element identifier of the target element, wherein the target element and the target element identifier are uniquely associated.
[0078] This application's embodiments utilize the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determine the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without requiring testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development, without waiting for existing functions to be implemented, thus improving the efficiency of page launch.
[0079] This application provides a storage medium, which is a computer-readable medium, storing a computer program. When executed by a processor, the computer program implements the method provided in any embodiment of this application, including the following steps S11 to S14:
[0080] S11, Determine the target logical name of the target element;
[0081] S12, based on the target logical name, invoke the target call interface;
[0082] S13, using the target calling interface, based on the first mapping relationship table between logical names and element identifiers, determine the target element identifier corresponding to the target logical name; wherein, the logical name and element identifier of each element are unique;
[0083] S14, Based on the target element identifier, determine the target position of the target element.
[0084] When a computer program is executed by a processor to determine the target location of a target element based on the target element identifier, the processor specifically performs the following steps: using the target call interface, based on the first mapping relationship table and the second mapping relationship table, to determine the target title name corresponding to the target element identifier, wherein the second mapping relationship table includes a second mapping relationship table between logical names and title names; determining the location of the target title name and using it as the target location of the target element.
[0085] When a computer program is executed by a processor using the element location method, the processor also performs the following steps: based on the target location, identifying the page information corresponding to the target element in the page to which the target element belongs.
[0086] When a computer program is executed by a processor using the element location method, the processor also performs the following steps: according to the generation rules, a preset number of characters are used to generate a target element identifier for the target element, wherein the target element and the target element identifier are uniquely associated.
[0087] This application's embodiments utilize the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determine the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without requiring testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development, without waiting for existing functions to be implemented, thus improving the efficiency of page launch.
[0088] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk. Optionally, in this embodiment, the processor executes the method steps described in the above embodiments according to the program code stored in the storage medium. Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, which will not be repeated here. Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed on a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be executed in a different order than those described here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any specific hardware and software combination.
[0089] This application provides an electronic device, the structural schematic diagram of which is shown below. Figure 3 As shown, it includes at least a memory 301 and a processor 302. The memory 301 stores a computer program, and the processor 302 implements the method provided in any embodiment of this application when executing the computer program in the memory 301. Exemplarily, the steps of the electronic device computer program are as follows: S21 to S23:
[0090] S21, Determine the target logical name of the target element;
[0091] S22, based on the target logical name, invoke the target call interface;
[0092] S23, using the target calling interface, based on the first mapping relationship table between logical names and element identifiers, determine the target element identifier corresponding to the target logical name; wherein, the logical name and element identifier of each element are unique;
[0093] S24, Based on the target element identifier, determine the target position of the target element.
[0094] When the processor determines the target location of the target element based on the target element identifier stored in the execution memory, it also executes the following computer program: using the target call interface, based on the first mapping table and the second mapping table, to determine the target title name corresponding to the target element identifier, wherein the second mapping table includes a second mapping table between logical names and title names; and to determine the location of the target title name, and use it as the target location of the target element.
[0095] When the processor executes the element location method stored in memory, it also executes the following computer program: based on the target location, it identifies the page information corresponding to the target element in the page to which the target element belongs.
[0096] When the processor executes the element location method stored in the memory, it also executes the following computer program: according to the generation rules, it generates a target element identifier of the target element from a preset number of characters, wherein the target element and the target element identifier are uniquely associated.
[0097] This application's embodiments utilize the target call interface to determine the target element identifier corresponding to the target logical name of the target element, and then determine the target position of the target element based on the target element identifier. That is, it can automatically determine the target position of each target element on the page without requiring testers to manually determine the target position. Furthermore, after the position of the target element on the page is updated, testers do not need to rewrite the script, saving time and effort, greatly improving the testing efficiency of the user interface, and having high maintainability. In addition, test scripts can be written simultaneously with page development, without waiting for existing functions to be implemented, thus improving the efficiency of page launch.
[0098] Furthermore, although exemplary embodiments have been described herein, their scope includes any and all embodiments based on this application that have equivalent elements, modifications, omissions, combinations (e.g., schemes involving intersections of various embodiments), adaptations, or alterations. Elements in the claims will be interpreted broadly based on the language used in the claims and are not limited to the examples described in this specification or during the implementation of this application, which will be interpreted as non-exclusive. Therefore, this specification and examples are intended to be considered illustrative only, and the true scope and spirit are indicated by the full scope of the following claims and their equivalents.
[0099] The above description is intended to be illustrative and not restrictive. For example, the above examples (or one or more of them) can be used in combination with each other. Other embodiments can be used by those skilled in the art when reading the above description. Furthermore, in the above detailed description, various features may be grouped together to simplify the application. This should not be construed as an intention that a disclosed feature not claimed is necessary for any claim. Rather, the subject matter of the application may be less than all the features of a particular disclosed embodiment. Thus, the following claims are incorporated herein by reference as examples or embodiments, wherein each claim is an independent, separate embodiment, and these embodiments are contemplated to be combined with each other in various combinations or arrangements. The scope of this application should be determined by reference to the appended claims and the full scope of their equivalents.
[0100] The foregoing has described in detail several embodiments of this application, but this application is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications based on the concept of this application, and all such variations and modifications should fall within the scope of protection claimed in this application.
Claims
1. An element location method, applied to UI testing on a low-code platform, comprising: Determine the target logical name of the target element; Based on the pre-defined mapping relationship between pages and API calls, the target API call corresponding to the page to which the target logical name belongs is retrieved; wherein, each page has an element relationship table, which includes the logical names of each element belonging to that page; Using the target call interface, and based on the first mapping table between logical names and element identifiers, the target element identifier corresponding to the target logical name is determined; wherein, the logical name and element identifier of each element are unique. Based on the target element identifier, the target position of the target element is determined; Determining the target location of the target element based on the target element identifier includes: Using the target call interface, based on the first mapping table and the second mapping table, the target title name corresponding to the target element identifier is determined, wherein the second mapping table includes a second mapping table between logical names and title names; Determine the location of the target title name and use it as the target location of the target element.
2. The element location method according to claim 1, wherein the first mapping table is stored on a low-code platform or the first mapping table is stored in the target calling interface.
3. The element positioning method according to claim 1 further includes: The logical names in the second mapping table correspond to one or more title names.
4. The element positioning method according to claim 1 further includes: Based on the target location, identify the page information corresponding to the target element in the page to which the target element belongs.
5. The element positioning method according to claim 1 further includes: According to the generation rules, a preset number of characters are used to generate the target element identifier of the target element, wherein the target element and the target element identifier are uniquely associated.
6. An element positioning device for UI testing on a low-code platform, comprising: The first determining module is configured to determine the target logical name of the target element; The retrieval module is configured to retrieve the target call interface corresponding to the page to which the target logical name belongs, based on a pre-defined mapping relationship between pages and call interfaces; wherein, each page corresponds to an element relationship table, which includes the logical names of each element belonging to that page; The second determining module is configured to use the target calling interface to determine the target element identifier corresponding to the target logical name based on the first mapping relationship table between logical names and element identifiers; wherein, the logical name and element identifier of each element are unique; The third determining module is configured to determine the target position of the target element based on the target element identifier; The third determining module is specifically configured as follows: Using the target call interface, based on the first mapping table and the second mapping table, the target title name corresponding to the target element identifier is determined, wherein the second mapping table includes a second mapping table between logical names and title names; Determine the location of the target title name and use it as the target location of the target element.
7. The element positioning device according to claim 6 further includes an identification module, configured as follows: Based on the target location, identify the page information corresponding to the target element in the page to which the target element belongs.
8. The element positioning device according to claim 6 further includes a generation module, configured as follows: According to the generation rules, a preset number of characters are used to generate the target element identifier of the target element, wherein, The target element and the target element identifier are uniquely associated.
Citation Information
Patent Citations
User interface test method and device, storage medium and computer equipment
CN111552627A
Ui element positioning method and system, electronic equipment and storage medium
CN112181412A