Interface element positioning method and device, electronic equipment and storage medium
By finding matching target elements in the user interface and using associated elements to assist in positioning, the problem of low efficiency and accuracy of interface element positioning is solved, and more efficient and accurate element positioning is achieved.
Patent Information
- Application Number
- CN202311380116.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2025-04-25
AI Technical Summary
Due to the complexity of layout in the user interface, it is difficult to quickly and accurately locate page elements, making it difficult to accurately control the relevant processing process.
By finding the target element that matches the element information and the element information to be located in the user interface, and when multiple target elements are found, the associated element uniquely associated with the element to be located is found as the target associated element, thereby positioning the element to be located.
The efficiency and accuracy of interface element positioning is improved, especially when multiple target elements exist, the elements to be positioned can be found more accurately by assisting in positioning by associated elements.
Smart Images

Figure CN119883445A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method, device, electronic device, and storage medium for positioning interface elements. Background Art
[0002] In many business scenarios, it is necessary to locate elements of the user interface (UI). For example, in a client automation test scenario, it is necessary to accurately locate the UI elements before triggering a specified test operation.
[0003] Due to the complexity of UI layout, it is impossible to quickly and accurately locate the unique target element in many scenarios, which makes it difficult to accurately control and implement related processing processes based on the target element, because a method is needed to quickly and accurately locate page elements. Summary of the invention
[0004] The embodiments of the present disclosure provide a method, device, electronic device and storage medium for positioning an interface element, so as to improve the efficiency and accuracy of positioning the interface element.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for positioning an interface element, comprising:
[0006] Searching for a target element in the user interface whose element information matches the information of the element to be located, wherein the information of the element to be located is the element information of the element to be located in the user interface;
[0007] In the case where at least two target elements are found in the user interface, searching for an associated element that is uniquely associated with the element to be located as a target associated element of the element to be located;
[0008] The element to be located is located from the at least two target elements according to the target associated element of the element to be located.
[0009] In a second aspect, the embodiments of the present disclosure further provide a device for positioning an interface element, including:
[0010] A first search module, used to search in a user interface for a target element whose element information matches information of an element to be located, wherein the information of the element to be located is element information of the element to be located in the user interface;
[0011] A second search module is used to search for an associated element uniquely associated with the element to be located as a target associated element of the element to be located when at least two target elements are found in the user interface;
[0012] The first element locating module is used to locate the element to be located from the at least two target elements according to the target associated element of the element to be located.
[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:
[0014] one or more processors;
[0015] a memory for storing one or more programs,
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for positioning the interface elements as described in the embodiment of the present disclosure.
[0017] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for positioning an interface element as described in the embodiment of the present disclosure.
[0018] The element positioning method, device, electronic device and storage medium provided by the embodiments of the present disclosure search for a target element whose element information matches the information of the element to be positioned in the user interface, where the information of the element to be positioned is the element information of the element to be positioned in the user interface; when at least two target elements are found in the user interface, search for an associated element that is uniquely associated with the element to be positioned as the target associated element of the element to be positioned; and locate the element to be positioned from the at least two target elements based on the target associated element of the element to be positioned. The embodiments of the present disclosure utilize the above technical solution, and when multiple interface elements are found based on the element information of the element to be positioned, the element to be positioned is positioned based on the associated element that is uniquely associated with the element to be positioned, which can improve the efficiency and accuracy of element positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0020] Figure 1 A schematic diagram of a flow chart of a method for positioning an interface element provided by an embodiment of the present disclosure;
[0021] Figure 2 A schematic diagram of a flow chart of another method for positioning an interface element provided by an embodiment of the present disclosure;
[0022] Figure 3 A schematic diagram of a flow chart of an optional method for positioning interface elements provided in an embodiment of the present disclosure;
[0023] Figure 4 A structural block diagram of a positioning device for interface elements provided by an embodiment of the present disclosure;
[0024] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0026] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0027] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0028] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0031] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0032] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0033] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection element for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0034] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0035] Figure 1 The present invention provides a flowchart of a method for positioning an interface element according to an embodiment of the present invention. The method can be executed by a positioning device for an interface element, wherein the device can be implemented by software and / or hardware and can be configured in an electronic device, typically a mobile phone or a tablet computer. The method for positioning an interface element provided by an embodiment of the present invention is applicable to the scenario of positioning elements in a user interface. Figure 1 As shown, the method for positioning the interface element provided in this embodiment may include:
[0036] S101: Searching for a target element in a user interface whose element information matches information of an element to be located, where the information of the element to be located is element information of the element to be located in the user interface.
[0037] Among them, the user interface can be the interface where the element to be located is located. The user interface can be configured with multiple interface elements, such as controls, etc. The element to be located can be the interface element that currently needs to be located. The information of the element to be located can be the element information of the element to be located. Exemplarily, the information of the element to be located can be information used to locate the element to be located, such as text information, type information and / or identification information of the element to be located. The target element can be an interface element whose element information in the user interface matches the information of the element to be located, in other words, an interface element found in the user interface based on the information of the element to be located.
[0038] In this embodiment, when it is necessary to locate a certain interface element in the user interface, the interface element can be searched in the user interface based on the element information of the interface element, so as to determine whether it is necessary to locate the interface element based on the associated elements of the interface element according to the number of interface elements found.
[0039] Exemplarily, the element information to be located of the element to be located in the user interface can be obtained, and element search can be performed in the user interface based on the element information to be located, such as searching for an element in the user interface whose element information matches the element information to be located of the element to be located, as the target element.
[0040] S102: When at least two target elements are found in the user interface, search for an associated element that is uniquely associated with the element to be located as a target associated element of the element to be located.
[0041] The associated elements of the element to be located may be elements in the user interface that are associated with the element to be located, such as elements that are uniquely associated with the element to be located, which may be set in advance; or they may be determined based on the relationship between the elements in the user interface and the element to be located, such as based on the relative position relationship between the elements in the user interface and the element to be located and / or the hierarchical relationship in the element tree of the user interface.
[0042] Optionally, the associated element includes a preconfigured initial associated element, or includes a preconfigured initial associated element and at least one ancestor element of the initial associated element. The initial associated element can be understood as a preconfigured associated element of the element to be located. In this embodiment, the tester or developer can preconfigure one or more associated elements of the element to be located, such as recording the element information of one or more associated elements of the element to be located in the configuration information of the element to be located. At this time, the initial associated element can be considered to be the associated element recorded in the configuration information of the element to be located, in other words, the interface element in the user interface corresponding to the associated element information recorded in the configuration information of the element to be located. The ancestor element of the initial associated element can be an interface element located in the upper layer of the initial associated element in the element tree of the user interface, such as an element on the path from the root element of the element tree to the initial associated element.
[0043] The target associated element may be an associated element that is uniquely associated with the element to be located, such as an interface element that is associated with the element to be located and is only associated with the element to be located.
[0044] In this embodiment, since the information of the element to be located may not be able to uniquely locate the element to be located, it may happen that multiple target elements are found in the user interface based on the information of the element to be located. Therefore, when there are multiple target elements, the target-associated elements of the element to be located can be used to assist in locating the locating element, so as to improve the efficiency and accuracy of element positioning.
[0045] Specifically, after searching and determining the target element in the user interface based on the information of the element to be located, it can be determined whether the number of target elements found is multiple. If it is determined that the number of target elements is multiple, an associated element uniquely associated with the element to be located can be searched in the user interface as the target associated element of the element to be located.
[0046] S103: Locate the element to be located from the at least two target elements according to the target associated element of the element to be located.
[0047] In this embodiment, after the target associated element of the element to be located is determined, the element to be located can be located based on the target associated element of the element to be located, and the element to be located among the at least two target elements can be determined, such as determining which target element is the element to be located that actually needs to be located based on the target associated element of the element to be located.
[0048] In addition, if it is determined that the number of target elements is one, that is, if a unique target element is found in the user interface based on the information of the element to be located of the element to be located, the associated elements of the element to be located can be further used to verify the found target element to improve the accuracy of element positioning; or the unique target element found can be directly determined as the element to be located without using the associated elements of the element to be located to verify the target element, thereby further improving the efficiency of element positioning. At this time, optionally, the method for locating interface elements provided in this embodiment also includes: when a target element is found in the user interface, the found target element is positioned as the element to be located.
[0049] In this embodiment, the method of locating the element to be located from at least two target elements based on the target-associated element of the element to be located can be flexibly set as needed. For example, it is possible to determine which of the at least two target elements is the element to be located based on the relative position relationship between each target element and the target-associated element of the element to be located when displayed in the user interface; it is also possible to determine which of the at least two target elements is the element to be located based on the hierarchical relationship between each target element and the target-associated element of the element to be located in the element tree of the user interface, and so on.
[0050] In some embodiments, before searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located, it also includes: determining an initial associated element of the element to be located based on the associated element configuration information of the element to be located, the initial associated element being an associated element that matches the associated element configuration information; searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located includes: when the initial associated element is unique in the user interface, searching for an associated element uniquely associated with the element to be located as the target associated element of the element to be located.
[0051] In the above embodiment, in the case where at least two target elements are found in the user interface, the element to be located can be located based on the target associated element of the element to be located only when the element to be located has an initial associated element that is unique in the user interface; and when the element to be located does not have an initial associated element that is unique in the user interface, the element to be located is no longer located based on the target associated element of the element to be located, for example, the process can be jumped to other positioning processes, and other positioning methods can be used to locate the element to be located, etc., so as to further improve the accuracy of element positioning.
[0052] Among them, the associated element configuration information can be understood as pre-configured associated element information, which can include element information of the initial associated element, such as text information, type information and / or identification information of the initial associated element. The number of initial associated elements of the element to be located is not limited. For example, the element to be located can be configured with one or more initial associated elements, and the element information of different initial associated elements may be different. The uniqueness of an interface element (such as an initial associated element) in the user interface can be understood as the interface element can be uniquely located in the user interface based on the element information of the interface element, such as only one interface element can be found in the user interface based on the element information of the interface element.
[0053] In the above implementation, if at least two target elements are found in the user interface, the initial associated element of the element to be located can be further determined based on the associated element configuration information of the element to be located. For example, when there are multiple associated element configuration information corresponding to different initial associated elements of the element to be located, the initial associated element corresponding to the element information and the associated element configuration information can be searched in the user interface for each associated element configuration information, and based on the number of initial associated elements found, it can be determined whether the initial associated element corresponding to the associated element configuration information is unique in the user interface, such as determining whether only one initial associated element with element information matching the associated element configuration information can be found in the user interface based on the associated element configuration information.
[0054] Thus, if the element to be located has an initial associated element that is unique in the user interface, the element to be located can be located from the at least two target elements based on the target associated element of the element to be located. Exemplarily, the element to be located can be located from the at least two target elements based on one or more initial associated elements that are unique in the user interface and / or the ancestor element of the initial associated element.
[0055] In some implementations, the method for positioning interface elements provided in this embodiment can be applied to element testing scenarios. For example, the element to be positioned can be the element to be tested currently in the user interface. Thus, after positioning the element to be positioned, the positioned element can be tested, such as testing whether the element to be positioned can respond correctly when triggered. At this point, optionally, the element to be positioned is the element to be tested currently in the user interface, and the method for positioning interface elements provided in this embodiment further includes: testing the element to be positioned.
[0056] The method for locating interface elements provided in this embodiment searches for a target element whose element information matches the information of the element to be located in the user interface, and the information of the element to be located is the element information of the element to be located in the user interface; when at least two target elements are found in the user interface, an associated element uniquely associated with the element to be located is searched as the target associated element of the element to be located; and the element to be located is located from the at least two target elements based on the target associated element of the element to be located. This embodiment utilizes the above technical solution, and when multiple interface elements are found based on the element information of the element to be located, the element to be located is located based on the associated element uniquely associated with the element to be located, which can improve the efficiency and accuracy of element positioning.
[0057] Figure 2 A flow chart of another method for locating interface elements provided for an embodiment of the present disclosure. The scheme in this embodiment can be combined with one or more optional schemes in the above-mentioned embodiments. Optionally, locating the element to be located from the at least two target elements based on the target-associated element of the element to be located includes: searching among the at least two target elements whether there are descendant elements associated with the target-associated element of the element to be located; when a unique descendant element of the target-associated element of the element to be located is found among the target elements, locating the unique descendant element found as the element to be located.
[0058] Optionally, the method for locating interface elements provided in this embodiment also includes: when a descendant element of the target associated element of the element to be located is not found from the target element, then tracing back upward according to the node parent-child relationship to find the parent element of the target associated element of the element to be located, and using it as the new target associated element of the element to be located, and continuing to search from the at least two target elements for the only descendant element associated with the new target associated element of the element to be located, and locating the only descendant element found as the element to be located.
[0059] Correspondingly, such as Figure 2 As shown, the method for positioning the interface element provided in this embodiment may include:
[0060] S201: Searching for a target element in a user interface whose element information matches information of an element to be located, where the information of the element to be located is element information of the element to be located in the user interface.
[0061] S202: When at least two target elements are found in the user interface, search for an associated element that is uniquely associated with the element to be located as a target associated element of the element to be located.
[0062] S203: Search among the at least two target elements to see whether there is a descendant element associated with the target associated element of the element to be located, and execute S204 or S205.
[0063] In this embodiment, when there are multiple target elements, the element to be located can be further located from the at least two target elements according to the hierarchical relationship between the target element and the target-associated element in the element tree corresponding to the user interface.
[0064] Specifically, after determining the target associated element that is uniquely associated with the element to be located, it is possible to search among the at least two target elements found to determine whether there are descendant elements associated with the target associated element itself. For example, for each target element, it is determined whether the target element is a descendant element associated with the target associated element itself, so as to perform different operations based on the determination result.
[0065] S204: When a unique descendant element of the target associated element of the element to be located is found from the target element, the unique descendant element found is located as the element to be located.
[0066] Since the element to be located is the target element, there is an association relationship between the positioning element and the target-associated element, such as being a descendant element of the target-associated element and / or a descendant element of the target-associated element. Therefore, when only one target element among at least two target elements is a descendant element of the target-associated element, the target element that is a descendant element of the target-associated element can be determined as the element to be located, thereby completing the positioning of the element to be located.
[0067] S205. When a descendant element of the target associated element of the element to be located is not found from the target element, the parent element of the target associated element of the element to be located is searched back upward according to the node parent-child relationship as the new target associated element of the element to be located, and the only descendant element associated with the new target associated element of the element to be located is searched from the at least two target elements, and the only descendant element found is located as the element to be located.
[0068] In this embodiment, if a descendant element of the target-associated element is not found from the target element, it means that the element to be located may not be a descendant element of the target-associated element. For example, the element to be located may be a descendant element of one or more ancestor elements of the security-associated element. Therefore, when the only descendant element of the target-associated element is not found from the target element, the parent element of the target-associated element can be used as the new target-associated element of the element to be located, and the displacement descendant element associated with the new target-associated element itself can be searched from the at least two target elements.
[0069] Exemplarily, when a descendant element of the target-associated element is not found in the target element, the parent element of the target-associated element in the element tree of the user interface can be used as the new target-associated element of the element to be located, and the process returns to execute S203 until the element to be located is located or the target-associated element has no parent element.
[0070] In addition, when multiple descendant elements of target-associated elements are found from the target element, the element to be located can no longer be located based on the target-associated elements of the element to be located. For example, other positioning processes can be jumped to and other positioning methods can be used to locate the element to be located.
[0071] Figure 3 The following is a flow chart of an optional method for positioning interface elements provided by an embodiment of the present disclosure. Figure 3 As shown, in an optional implementation, the interface element provided in this embodiment can be applied to a control test scenario. At this time, assuming that the user interface to be tested is Page-A, the element to be located is control Control-A, and the initial associated element of the element to be located is Control-B, the positioning process of the interface element can be described as:
[0072] A1. Search for the element Control-A to be located in the client interface Page-A. If 0 or 1 controls are found, there is no confusion in the search results, and the associated control location process ends; if multiple controls are found, the associated control location process is carried out and A2 is executed.
[0073] In addition, in the case where one control is found, the found control can be determined as the element to be located.
[0074] A2. Determine whether the currently located Control-A has an associated control. If Control-A does not have an associated control, the associated control location process ends; if Control-A has an associated control Control-B, the associated control location process continues and executes A3.
[0075] A3. Determine whether the associated control Control-B is unique in the tested interface Page-A. If the associated control Control-B is not unique in the tested interface Page-A, the associated control positioning process ends; if the associated control Control-B is unique in the tested interface Page-A, the associated control positioning process continues, Control-B is used as the current associated control, and A4 is executed.
[0076] A4. Search for Control-A in the range of descendant controls of the current associated control. If one control is found, the location is successful, and the found control is determined as the element to be located; if the control is not found, the node is backtracked upward, the parent control of the current associated control is used as the current associated control, and the operation of searching for Control-A in the range of descendant controls of the current associated control is returned to use the parent control of the current associated control for the search.
[0077] Specifically, if the current associated control has a parent control, the operation of searching for Control-A within the range of descendant controls of the current associated control is returned; if the current associated control has no parent control, the associated control positioning process is terminated.
[0078] The method for locating interface elements provided in this embodiment, when multiple interface elements are found based on the element information of the element to be located, further determines the element to be located among the multiple interface elements based on the initial associated elements of the element to be located and its ancestor elements, thereby improving the efficiency and accuracy of element positioning.
[0079] Figure 4This is a structural block diagram of a device for positioning interface elements provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and can be configured in an electronic device, typically a mobile phone or a computer, and can locate elements in a user interface by executing a method for positioning interface elements. Figure 4 As shown, the interface element positioning device provided in this embodiment may include: a first search module 401, a second search module 402 and a first element positioning module 403, wherein:
[0080] A first search module 401 is used to search in a user interface for a target element whose element information matches information of an element to be located, where the information of the element to be located is the element information of the element to be located in the user interface;
[0081] A second search module 402 is configured to search, when at least two target elements are found in the user interface, for an associated element uniquely associated with the element to be located as a target associated element of the element to be located;
[0082] The first element locating module 403 is configured to locate the element to be located from the at least two target elements according to the target associated element of the element to be located.
[0083] The device for positioning interface elements provided in this embodiment uses a first search module to search for a target element whose element information matches the information of the element to be positioned in the user interface, and the information of the element to be positioned is the element information of the element to be positioned in the user interface; when at least two target elements are found in the user interface by the second search module, an associated element uniquely associated with the element to be positioned is searched as the target associated element of the element to be positioned; and the first element positioning module locates the element to be positioned from the at least two target elements based on the target associated element of the element to be positioned. This embodiment utilizes the above technical solution, and when multiple interface elements are found based on the element information of the element to be positioned, the element to be positioned is positioned based on the associated element uniquely associated with the element to be positioned, which can improve the efficiency and accuracy of element positioning.
[0084] In the above scheme, the first element positioning module 403 may include: a searching unit, used to search among the at least two target elements whether there is a descendant element associated with the target associated element of the element to be positioned; and a positioning unit, used to locate the only descendant element found as the element to be positioned when a only descendant element of the target associated element of the element to be positioned is found among the target elements.
[0085] Furthermore, the positioning device for interface elements provided in this embodiment may also include: a backtracking module, which is used to, when a descendant element of the target associated element of the element to be located is not found from the target element, backtrack upward according to the node parent-child relationship to find the parent element of the target associated element of the element to be located, as the new target associated element of the element to be located, and continue to search from the at least two target elements for the only descendant element associated with the new target associated element of the element to be located, and locate the only descendant element found as the element to be located.
[0086] Furthermore, the positioning device for interface elements provided in this embodiment may also include: an element determination module, which is used to determine the initial associated element of the element to be located according to the associated element configuration information of the element to be located before searching for the associated element uniquely associated with the element to be located as the target associated element of the element to be located, wherein the initial associated element is an associated element that matches the associated element configuration information; the second search module 402 can be used to: when the initial associated element is unique in the user interface, search for the associated element uniquely associated with the element to be located as the target associated element of the element to be located.
[0087] Furthermore, the device for locating interface elements provided in this embodiment may further include: a second element locating module, which is used to locate the found target element as the element to be located when a target element is found in the user interface.
[0088] In the above solution, the element to be located may be an element to be tested currently in the user interface. The device for locating interface elements provided in this embodiment may further include: an element testing module for testing the element to be located.
[0089] In the above solution, the association element may include a preconfigured initial association element, or include a preconfigured initial association element and at least one ancestor element of the initial association element.
[0090] The positioning device of the interface element provided in the embodiment of the present disclosure can execute the positioning method of the interface element provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of executing the positioning method of the interface element. For technical details not fully described in this embodiment, please refer to the positioning method of the interface element provided in any embodiment of the present disclosure.
[0091] Reference below Figure 5, which shows a schematic diagram of the structure of an electronic device (e.g., a test device) 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0092] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0093] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0094] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0095] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0096] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0097] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0098] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: searches for a target element whose element information matches the information of the element to be located in the user interface, and the information of the element to be located is the element information of the element to be located in the user interface; when at least two target elements are found in the user interface, searches for an associated element uniquely associated with the element to be located as a target associated element of the element to be located; and locates the element to be located from the at least two target elements based on the target associated element of the element to be located.
[0099] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0100] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, constitute a limitation on the unit itself.
[0102] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0103] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] According to one or more embodiments of the present disclosure, Example 1 provides a method for positioning an interface element, including:
[0105] Searching for a target element in the user interface whose element information matches the information of the element to be located, wherein the information of the element to be located is the element information of the element to be located in the user interface;
[0106] In the case where at least two target elements are found in the user interface, searching for an associated element that is uniquely associated with the element to be located as a target associated element of the element to be located;
[0107] The element to be located is located from the at least two target elements according to the target associated element of the element to be located.
[0108] According to one or more embodiments of the present disclosure, Example 2 is a method according to Example 1, wherein locating the element to be located from the at least two target elements based on the target associated element of the element to be located includes:
[0109] Searching from the at least two target elements whether there is a descendant element associated with the target associated element of the element to be located;
[0110] When a unique descendant element of the target associated element of the element to be located is found from the target element, the unique descendant element found is located as the element to be located.
[0111] According to one or more embodiments of the present disclosure, Example 3 is the method according to Example 2, further comprising:
[0112] When a descendant element of the target associated element of the element to be located is not found from the target element, the parent element of the target associated element of the element to be located is searched back upward according to the node parent-child relationship, and the parent element is used as the new target associated element of the element to be located, and the only descendant element associated with the new target associated element of the element to be located is continued to be searched from the at least two target elements, and the only descendant element found is located as the element to be located.
[0113] According to one or more embodiments of the present disclosure, Example 4 is the method according to Example 1, and before searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located, further includes:
[0114] Determining an initial associated element of the element to be located according to the associated element configuration information of the element to be located, wherein the initial associated element is an associated element that matches the associated element configuration information;
[0115] The step of searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located includes:
[0116] When the initial associated element is unique in the user interface, an associated element uniquely associated with the element to be located is searched as a target associated element of the element to be located.
[0117] According to one or more embodiments of the present disclosure, Example 5 is the method according to Example 1, further comprising:
[0118] When a target element is found in the user interface, the found target element is located as the element to be located.
[0119] According to one or more embodiments of the present disclosure, Example 6 is a method according to any one of Examples 1-5, wherein the element to be located is an element currently to be tested in the user interface, and the method further includes:
[0120] The element to be located is tested.
[0121] According to one or more embodiments of the present disclosure, Example 7 is a method according to any one of Examples 1-5, wherein the associated element includes a preconfigured initial associated element, or includes a preconfigured initial associated element and at least one ancestor element of the initial associated element.
[0122] According to one or more embodiments of the present disclosure, Example 8 provides a positioning device for an interface element, including:
[0123] A first search module, used to search in a user interface for a target element whose element information matches information of an element to be located, wherein the information of the element to be located is element information of the element to be located in the user interface;
[0124] A second search module is used to search for an associated element uniquely associated with the element to be located as a target associated element of the element to be located when at least two target elements are found in the user interface;
[0125] The first element locating module is used to locate the element to be located from the at least two target elements according to the target associated element of the element to be located.
[0126] According to one or more embodiments of the present disclosure, Example 9 provides an electronic device, including:
[0127] one or more processors;
[0128] a memory for storing one or more programs,
[0129] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for positioning the interface element as described in any one of Examples 1-7.
[0130] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for positioning an interface element as described in any one of Examples 1-7.
[0131] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0132] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0133] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for positioning an interface element, characterized in that: include: Searching for a target element in the user interface whose element information matches the information of the element to be located, wherein the information of the element to be located is the element information of the element to be located in the user interface; In the case where at least two target elements are found in the user interface, searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located; The element to be located is located from the at least two target elements according to the target associated element of the element to be located.
2. The method according to claim 1, characterized in that The step of locating the element to be located from the at least two target elements according to the target associated element of the element to be located includes: Searching from the at least two target elements whether there is a descendant element associated with the target associated element of the element to be located; When a unique descendant element of the target associated element of the element to be located is found from the target element, the unique descendant element found is located as the element to be located.
3. The method according to claim 2, characterized in that The method further comprises: When a descendant element of the target associated element of the element to be located is not found from the target element, the parent element of the target associated element of the element to be located is searched back upward according to the node parent-child relationship, and is used as the new target associated element of the element to be located, and the only descendant element associated with the new target associated element of the element to be located is continued to be searched from the at least two target elements, and the only descendant element found is located as the element to be located.
4. The method according to claim 1, characterized in that: Before searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located, the method further includes: Determining an initial associated element of the element to be located according to the associated element configuration information of the element to be located, wherein the initial associated element is an associated element that matches the associated element configuration information; The step of searching for an associated element uniquely associated with the element to be located as a target associated element of the element to be located includes: When the initial associated element is unique in the user interface, an associated element uniquely associated with the element to be located is searched as a target associated element of the element to be located.
5. The method according to claim 1, characterized in that Also includes: When a target element is found in the user interface, the found target element is located as the element to be located.
6. The method according to any one of claims 1 to 5, characterized in that: The element to be located is an element to be tested currently in the user interface, and the method further includes: The element to be located is tested.
7. The method according to any one of claims 1 to 5, characterized in that: The association element includes a preconfigured initial association element, or includes a preconfigured initial association element and at least one ancestor element of the initial association element.
8. A positioning device for interface elements, characterized in that: include: A first search module, used to search in a user interface for a target element whose element information matches information of an element to be located, wherein the information of the element to be located is element information of the element to be located in the user interface; A second search module is used to search for an associated element uniquely associated with the element to be located as a target associated element of the element to be located when at least two target elements are found in the user interface; The first element locating module is used to locate the element to be located from the at least two target elements according to the target associated element of the element to be located.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for positioning an interface element according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for positioning an interface element according to any one of claims 1 to 7 when executed.