CN112181412A - Ui element positioning method, system, electronic equipment and storage medium - Google Patents

Ui element positioning method, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN112181412A
CN112181412A CN202011030567.5A CN202011030567A CN112181412A CN 112181412 A CN112181412 A CN 112181412A CN 202011030567 A CN202011030567 A CN 202011030567A CN 112181412 A CN112181412 A CN 112181412A
Authority
CN
China
Prior art keywords
positioning
user
module
expected value
name
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011030567.5A
Other languages
Chinese (zh)
Inventor
王涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dilu Technology Co Ltd
Original Assignee
Dilu Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dilu Technology Co Ltd filed Critical Dilu Technology Co Ltd
Priority to CN202011030567.5A priority Critical patent/CN112181412A/en
Publication of CN112181412A publication Critical patent/CN112181412A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a ui element positioning method, a ui element positioning system, electronic equipment and a storage medium, wherein the method specifically comprises the following steps: storing each ui element, a parameter of each element, and an expected value of each element in a configuration file, wherein the expected value is a corresponding relation between each element and the parameter of the element; the parameters include an ID, a name and a storage path of the element; then, a method of locating the ui element is selected according to the information input by the user. The invention makes the acquisition of the ui element more flexible.

Description

Ui element positioning method, system, electronic equipment and storage medium
Technical Field
The invention belongs to the field of computers.
Background
In the prior art, when the ui element is obtained, the adopted method is too single, generally only one method is adopted to locate the ui element, so that the ui element cannot be identified when a user inputs parameters which do not belong to the method, the error rate is greatly increased, and the locating precision cannot be improved.
Disclosure of Invention
The purpose of the invention is as follows: in order to solve the problems in the background art, the invention provides a ui element positioning method, a ui element positioning system, an electronic device and a storage medium.
The technical scheme is as follows: the invention provides a ui element positioning method, which specifically comprises the following steps:
step 1: storing each ui element, a parameter of each ui element and an expected value of each ui element in a configuration file, wherein the expected value is a corresponding relation between each element and the parameter of the element; the parameters include an ID, a name and a storage path of the element;
step 2: if the user only inputs the ID of ui, the ui is positioned according to the method for searching the ID, if the user only inputs the name of ui, the ui is positioned according to the method for searching the name, the attribute or the label, and if the user only inputs the storage path of ui, the ui is positioned according to the method for searching the storage path; if the type of the parameter input by the user is more than or equal to 2, selecting a positioning method according to the ID, the name and the priority of the storage path;
and step 3: and returning the search result to the user.
And further specifically, the method further comprises positioning result judgment, specifically, the positioning result is compared with an expected value in the configuration file to judge whether the positioning is correct, and if the positioning is wrong, error information is recorded.
A ui element positioning system, comprising an input module, a storage module and a calculation module, wherein the input module is used for a user to input parameters; the storage module is used for storing each ui element, the parameters of each ui element and the expected value of each ui element; and the computing module selects a method for positioning the ui element according to the information input by the user and the content stored by the storage module, and positions the ui element by using the method.
Furthermore, the system also comprises a judging module which compares the positioning result with the expected value in the storage module to judge whether the positioning is correct or not, and if the positioning is wrong, error information is displayed.
Further, the system also comprises a log tracking module which is used for recording the error information and sending the error information to the user in the form of an email.
An electronic device for ui element localization, comprising a processor and a memory, the memory storing instructions for execution by the processor, the processor being configured to execute the instructions to perform the ui element localization method according to any one of claims 1-2.
A computer-readable storage medium storing a program, wherein the program is executed to implement the ui element location method according to any one of claims 1 to 2.
Has the advantages that: according to the method, the user positioning method is selected by judging the input parameters of the user, so that the ui element obtaining mode is more flexible, the expectation of the user is better met, and the user is prevented from searching for many times.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a block diagram of the system of the present invention;
FIG. 3 is a code flow diagram implementing the present invention.
Detailed Description
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention.
As shown in fig. 1, the present embodiment provides a ui element positioning method, which specifically includes:
step 1: storing each ui element, a parameter of each ui element and an expected value of each ui element in a configuration file, wherein the expected value is a corresponding relation between each element and the parameter of the element; the parameters include an ID, a name and a storage path of the element;
step 2: if the user only inputs the ID of ui, the ui is positioned according to the method for searching the ID, if the user only inputs the name of ui, the ui is positioned according to the method for searching the name, the attribute or the label, and if the user only inputs the storage path of ui, the ui is positioned according to the method for searching the storage path; if the type of the parameter input by the user is more than or equal to 2, selecting a positioning method according to the ID, the name and the priority of the storage path;
and step 3: and returning the search result to the user.
In this embodiment, the method further includes determining a positioning result, specifically, comparing the positioning result with an expected value in the configuration file, determining whether the positioning is correct, and if the positioning is wrong, recording error information.
As shown in fig. 2, a ui element positioning system includes an input module, a storage module and a calculation module, wherein the input module is used for a user to input parameters; the storage module is used for storing each ui element, the parameters of each ui element and the expected value of each ui element; and the computing module selects a method for positioning the ui element according to the information input by the user and the content stored by the storage module, and positions the ui element by using the method.
In this embodiment, the system further includes a determining module, where the determining module compares the positioning result with the expected value in the storage module, determines whether the positioning is correct, and if the positioning is wrong, displays an error message.
In this embodiment, the system further comprises a log tracking module for recording the error information and sending the error information to the user in the form of an email.
In this embodiment, python3.5 language is used as a programming language, and htmltestrunner library is used for outputting test results and generating a test report; jenkins is used for continuous integrated management. As shown in fig. 3, the method for implementing ui element positioning in this embodiment by programming specifically includes:
an environment installation part:
step A: install python version 3.5 and pip3 tools.
And B: htmltestrunner was installed using pip 3.
And C: and (4) obtaining jenkins version on gitubs, and then dpkg installing deb packets.
And (3) repackaging a selenium library interface:
step 1: filling relevant key parameters in a text txt file, wherein the relevant parameters relate to 5 relevant contents;
step 2: and (3) adding the content of the test: selecting an element object to be positioned on a page, determining a unique element identifier of the element object, and writing related parameter content into a configuration file;
step 3: the calling program confirms the calling method of the element object;
step 4: judging whether the final result of execution is in accordance with expectation;
step 5: displaying the execution condition of the corresponding element to be positioned;
in step1, the parameters are mainly defined as tag _ id, name, path, validity, expect and other fields, and the unique identifier corresponding to the element component is found in a browser mode.
In step2, the relevant content of tag _ id, name, path, reliability and expect of the element is filled in the corresponding text configuration file.
In step3, if tag _ id has a value, positioning an element in a findId mode; if the name has a value, the element is located by one of findName, findClasName and findTagName 3 modes; if the path has a value, positioning the element in a findXpath mode; if the tag _ id, the name and the path have values, judging the priorities of the tag _ id, the path and the name in sequence, and selecting one positioning element in a positioning mode; if tag _ id, name, path is empty, the element is located in one of findLinkText, findPLinkText, findCss3 ways.
In step4, it is determined whether the value of the execution program fetch element is compared with the expect value to see if it is expected.
In step5, the final execution result of the corresponding element is displayed, and if the execution fails, the user is prompted about the specific reason for the error and the related module.
And (4) finishing timing case execution, expected results, actual results, test report output and the like by combining Jenkins.
Step A1 time for using Jenkins to configure timed execution of use cases
Step A2, writing a code with Python to obtain a comparison between an actual result and an expected result
And step A3, pushing the case result of Python execution to related personnel in an HTML report mode by combining Jenkins.
The embodiments of the present invention have been described in detail with reference to the drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

Claims (7)

1. A ui element positioning method is characterized by comprising the following steps:
step 1: storing each ui element, a parameter of each ui element and an expected value of each ui element in a configuration file, wherein the expected value is a corresponding relation between each element and the parameter of the element; the parameters include an ID, a name and a storage path of the element;
step 2: if the user only inputs the ID of ui, the ui is positioned according to the method for searching the ID, if the user only inputs the name of ui, the ui is positioned according to the method for searching the name, the attribute or the label, and if the user only inputs the storage path of ui, the ui is positioned according to the method for searching the storage path; if the type of the parameter input by the user is more than or equal to 2, selecting a positioning method according to the ID, the name and the priority of the storage path;
and step 3: and returning the search result to the user.
2. The ui element positioning method according to claim 1, further comprising a positioning result judgment step of comparing the positioning result with an expected value in a configuration file to judge whether the positioning is correct, and if the positioning is wrong, recording error information.
3. A ui element positioning system, which is characterized by comprising an input module, a storage module and a calculation module, wherein the input module is used for a user to input parameters; the storage module is used for storing each ui element, the parameters of each ui element and the expected value of each ui element; and the computing module selects a method for positioning the ui element according to the information input by the user and the content stored by the storage module, and positions the ui element by using the method.
4. A ui element location system as claimed in claim 3, further comprising a judgment module for comparing the location result with the expected value stored in the storage module, judging whether the location is correct, and displaying an error message if the location is wrong.
5. A ui element locator system as claimed in claim 4, further comprising a log tracker for recording the error message and sending the error message to the user in the form of an email.
6. An electronic device for ui element localization, comprising a processor and a memory, the memory storing instructions for execution by the processor, the processor being configured to execute the instructions to perform the ui element localization method according to any one of claims 1-2.
7. A computer-readable storage medium storing a program, wherein the program is executed to implement the ui element location method according to any one of claims 1 to 2.
CN202011030567.5A 2020-09-27 2020-09-27 Ui element positioning method, system, electronic equipment and storage medium Pending CN112181412A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011030567.5A CN112181412A (en) 2020-09-27 2020-09-27 Ui element positioning method, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011030567.5A CN112181412A (en) 2020-09-27 2020-09-27 Ui element positioning method, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112181412A true CN112181412A (en) 2021-01-05

Family

ID=73944108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011030567.5A Pending CN112181412A (en) 2020-09-27 2020-09-27 Ui element positioning method, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112181412A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105320603A (en) * 2015-12-04 2016-02-10 上海斐讯数据通信技术有限公司 Locating system and method for browser page elements and automatic testing method thereof
US20170337321A1 (en) * 2016-05-17 2017-11-23 Google Inc. Systems and methods for automatic determination of layout constraints
CN109828903A (en) * 2018-12-14 2019-05-31 中国平安人寿保险股份有限公司 Automated testing method, device, computer installation and storage medium
CN110727603A (en) * 2019-10-25 2020-01-24 重庆誉存大数据科技有限公司 Improved method for automatically testing positioning elements based on UI (user interface)
CN111221612A (en) * 2020-01-03 2020-06-02 北京小米移动软件有限公司 Method, device and medium for positioning user interface element

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105320603A (en) * 2015-12-04 2016-02-10 上海斐讯数据通信技术有限公司 Locating system and method for browser page elements and automatic testing method thereof
US20170337321A1 (en) * 2016-05-17 2017-11-23 Google Inc. Systems and methods for automatic determination of layout constraints
CN109828903A (en) * 2018-12-14 2019-05-31 中国平安人寿保险股份有限公司 Automated testing method, device, computer installation and storage medium
CN110727603A (en) * 2019-10-25 2020-01-24 重庆誉存大数据科技有限公司 Improved method for automatically testing positioning elements based on UI (user interface)
CN111221612A (en) * 2020-01-03 2020-06-02 北京小米移动软件有限公司 Method, device and medium for positioning user interface element

Similar Documents

Publication Publication Date Title
US9870309B2 (en) Variable tracking in program debugging
CN109542761B (en) Software quality evaluation method, device and storage medium
CN110321284B (en) Test data entry method, device, computer equipment and storage medium
CN109672608B (en) Method for transmitting messages according to time
CN104423961A (en) Method and system for generating testing script
CN105573915A (en) Test method and device based on code coverage rate
CN104156305A (en) Application program testing method and device
CN111159982A (en) Document editing method and device, electronic equipment and computer readable storage medium
US9311348B2 (en) Method and system for implementing an array using different data structures
CN114218072A (en) Test script generation method and device, storage medium and computer equipment
CN112181412A (en) Ui element positioning method, system, electronic equipment and storage medium
CN110704686B (en) Quality detection method and device for semi-structured data, storage medium and equipment
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN110888641A (en) Automatic script generation method and device, server and storage medium
CN114253642B (en) System information processing method, device, electronic equipment and medium
CN109800330A (en) A kind of data processing method and device
CN106933735A (en) Test case update method and device
US20220374340A1 (en) Techniques for decoupled management of software test execution planning and corresponding software test execution runs
US20220374341A1 (en) Techniques for decoupled management of software test execution planning and corresponding software test execution runs
US20220374342A1 (en) Techniques for decoupled management of software test execution planning and corresponding software test execution runs
CN114780550A (en) Automatic updating method, device, equipment and medium for element positioning path
CN113010114A (en) Data processing method and device, computer equipment and storage medium
KR101665962B1 (en) Method of verifying modeling code, apparatus performing the same and storage media storing the same
CN113610117B (en) Underwater sensing data processing method and system based on depth data
CN113596849B (en) Wireless communication channel dynamic allocation method and system for smart home

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 210000 11th floor, building A1, Huizhi science and Technology Park, 8 Hengtai Road, Nanjing Economic and Technological Development Zone, Nanjing City, Jiangsu Province

Applicant after: DILU TECHNOLOGY Co.,Ltd.

Address before: Building C4, No.55 Liyuan South Road, moling street, Jiangning District, Nanjing City, Jiangsu Province

Applicant before: DILU TECHNOLOGY Co.,Ltd.