WO2019136961A1 - User interface display identification method, terminal device, storage medium and apparatus - Google Patents

User interface display identification method, terminal device, storage medium and apparatus Download PDF

Info

Publication number
WO2019136961A1
WO2019136961A1 PCT/CN2018/097518 CN2018097518W WO2019136961A1 WO 2019136961 A1 WO2019136961 A1 WO 2019136961A1 CN 2018097518 W CN2018097518 W CN 2018097518W WO 2019136961 A1 WO2019136961 A1 WO 2019136961A1
Authority
WO
WIPO (PCT)
Prior art keywords
screenshot
feature vector
target
user interface
normal
Prior art date
Application number
PCT/CN2018/097518
Other languages
French (fr)
Chinese (zh)
Inventor
彭远杰
刘慧众
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019136961A1 publication Critical patent/WO2019136961A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present application belongs to the field of mobile terminal technologies, and in particular, to a user interface display and identification method, a terminal device, a computer readable storage medium, and a device.
  • mobile phones and other mobile terminals can be applied to a variety of operating systems, such as the Android operating system. Since different models of mobile phones have different resolutions, multiple operating systems are applied to mobile phones of different resolutions, and must be compatible with mobile phones of different resolutions.
  • the existing detection user interface display is detected by the test script, that is, the entire test script is executed, and the test result is compared with the set fixed value after the test is completed. If the two are consistent, the test user interface is displayed normally, otherwise, the test user interface is tested. The display is not normal.
  • the existing detection method has the problem of low script maintenance efficiency. If the user interface is adjusted, the entire test case needs to be rewritten, and the fixed value needs to be reset again, and the test cost is high, which is not suitable for practical application.
  • the embodiment of the present invention provides a user interface display and identification method, a terminal device, a computer readable storage medium, and a device, so as to solve the problem that the script maintenance efficiency of the existing user interface display detection method is low.
  • a first aspect of the embodiment of the present application provides a user interface display and identification method, including:
  • a second aspect of the embodiments of the present application provides a user interface display identifying terminal device, including a memory, a processor, and a computer program stored in the memory and operable on the processor, the processor executing the The steps of the above user interface display identification method are implemented when the computer program is described.
  • a third aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the steps of the user interface display identification method.
  • a fourth aspect of the embodiments of the present application provides a user interface display identification apparatus, which may include a module for implementing the steps of the user interface display identification method.
  • the embodiment of the present application determines the cosine distance between the target interface screenshot and the normal interface screenshot by acquiring a target interface screenshot of the user interface to be detected, and determines that the cosine distance exceeds the pre-predetermined
  • the threshold is set, it is detected whether the level and position of each element control of the user interface to be detected are abnormal.
  • the detection is normal, it is determined that the user interface to be detected is displayed normally, and the problem that the existing user interface display detection method has low script maintenance efficiency is solved.
  • FIG. 1 is a schematic flowchart of a user interface display and identification method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a user interface display and identification method according to still another embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a user interface display recognition program according to an embodiment of the present application.
  • FIG. 7 is a schematic block diagram of a user interface display and identification terminal device provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a user interface display and identification method according to an embodiment of the present disclosure.
  • an angle trigger of a terminal is used as an example.
  • the terminal may be a smart phone or a tablet.
  • Mobile terminals such as computers.
  • the processing of the terminal may include the following steps:
  • S101 Obtain a target interface screenshot of the user interface to be detected, and extract a feature vector of the target interface screenshot.
  • the user interface to be detected is any user interface that needs to be detected, and the user interface may also be referred to as a user interface, which is a medium for interaction and information exchange between the system and the user, and realizes an internal form of information and a human acceptable form. The conversion between.
  • the method for obtaining the screenshot of the target interface of the user interface to be detected may be obtained in real time or acquired in a preset time.
  • the specific acquisition mode may be set according to actual needs.
  • the obtained target interface screenshot may be displayed, and a prompt for re-acquiring the screenshot may be generated. If the re-acquisition of the screenshot request is received, the target interface of the user interface to be detected is re-acquired according to the request.
  • the screenshot can be obtained by taking a screenshot of the target interface of the user interface to be detected multiple times, and selecting a target interface screenshot that meets the requirements from the obtained plurality of target interface screenshots, for example, selecting the clearest target interface screenshot.
  • the extracted feature vector may be saved to facilitate subsequent data query.
  • S102 Obtain a normal interface screenshot of the pre-stored normal user interface, and extract a feature vector of the normal interface screenshot.
  • the manner of obtaining the pre-stored normal user interface includes: pre-storing the correspondence between the user interface type and the normal user interface, obtaining the type of the user interface to be detected, and determining the normal user interface corresponding to the acquired type according to the foregoing relationship.
  • the pre-stored normal user interface may also be determined by an interface when the user interface to be detected is normally displayed.
  • the manner of obtaining the screenshot of the normal interface of the pre-stored normal user interface is the same as the way of obtaining the screenshot of the target interface of the user interface to be detected, which may be acquired in real time or acquired at a preset time.
  • S103 Determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot.
  • the cosine distance also called cosine similarity
  • cosine similarity is a measure of the magnitude of the difference between two individuals using the cosine of the angles of the two vectors in the vector space.
  • a vector is a directional line segment in a multidimensional space. If the directions of the two vectors are the same, that is, the angle is close to zero, then the two vectors are similar.
  • S104 Determine whether the cosine distance exceeds a preset threshold.
  • the preset threshold is set according to an actual requirement. If the cosine distance exceeds the preset threshold, step S105 is performed. If the cosine distance does not exceed the preset threshold, the user interface to be detected may be directly determined to be abnormal. The alarm is reminded.
  • the above-mentioned abnormality of the user interface to be detected is determined by the cosine distance, and the abnormality of the user interface to be detected is relatively large, because the above-mentioned screenshot of the target interface of the user interface to be detected is extracted, and the feature of the target interface screenshot is extracted.
  • Vector that is, the subsequent image display abnormality judgment is performed according to the feature vector of the image, and the feature vector is an overall feature of the image.
  • This judgment mode determines that the cosine distance exceeds a preset threshold when the abnormality of the display of the user interface to be detected is relatively small.
  • a subsequent detection step is performed when it is determined that the cosine distance exceeds a preset threshold.
  • the level of each element control of the above-mentioned user interface to be detected may include an application in a Mac, a browser, an iOS APP, and the like.
  • Obtaining the hierarchy and location of each element control of the user interface to be detected may be obtained during an automated testing process or during a multi-machine compatibility testing process.
  • the corresponding relationship between the user interface type and the abnormal control detection rule may be preset, the type of the user interface to be detected is obtained, and the abnormal control detection rule corresponding to the type of the user interface to be detected is determined according to the foregoing relationship, and the abnormal control is detected according to the abnormality control.
  • the rule detects whether the level and position of each of the above element controls are abnormal.
  • the first abnormality information may be generated, and may further be based on the first abnormality information.
  • the first alarm information is generated, and the alarm is performed according to the first alarm information. If it is detected that the position of the one or more element controls in the position of each of the element controls is abnormal, determining that the user interface to be detected displays an abnormality, may generate a second abnormality information, and further may generate a second abnormal information according to the second abnormality information. Second, the alarm information is alarmed according to the second alarm information.
  • the user interface display identification method in the embodiment of the present application can solve the problem that the script maintenance efficiency of the existing user interface display detection method is low, and at the same time, the user interface to be detected can be detected through the screenshot of the user interface to be detected.
  • the large anomaly display, combined with the level and position of each element control of the user interface to be detected, can further detect the abnormal display of the user interface, improve the accuracy of the user interface display recognition, reduce the test cost, and is suitable for practical applications.
  • FIG. 2 is a schematic flowchart of a user interface display identification method according to another embodiment of the present application.
  • the acquiring a target interface screenshot of the user interface to be detected, and extracting the feature vector of the target interface screenshot may include S201.
  • S202 to S207 are the same as S102 to S107 in the previous embodiment.
  • S201 may include S2011 to S2014:
  • S2011 Obtain a target interface screenshot of the user interface to be detected, select a first preset number of samples from the target interface screenshot, and extract a second preset number of features for each sample.
  • the first preset number and the second preset number may be set according to actual needs, for example, m samples may be selected from the acquired screenshots, and n features are extracted for each sample.
  • S2012 Form a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample.
  • each sample may be taken as one row to form a first matrix A of m*n.
  • S2013 Obtain a second matrix according to the first matrix and the transposed matrix of the first matrix.
  • S2014 Calculate a feature vector of the second matrix, and determine a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  • the feature vector of the matrix C is obtained, and the feature vector is the feature vector of the screenshot.
  • the method is simple, the obtained results are accurate, and are suitable for application.
  • FIG. 3 is a schematic flowchart of a user interface display identification method according to another embodiment of the present application.
  • the difference between the embodiment corresponding to FIG. 1 is that: according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot, determining that the cosine distance of the target interface screenshot and the normal interface screenshot may include S303 .
  • S301 to S302 are the same as S101 to S102 in the previous embodiment, and S304 to S307 are the same as S104 to S107 in the previous embodiment.
  • S303 may include S3031 to S3033:
  • S3031 Calculate a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot, respectively.
  • S3032 Obtain an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot.
  • S3033 Determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the length of the feature vector of the target interface screenshot, the length of the feature vector of the normal interface screenshot, and the inner product.
  • the cosine theorem describes the relationship between any one of the triangles and the three sides. Given the three sides of a triangle, you can use the cosine theorem to find the angle of each corner of the triangle. Assuming that the three sides of the triangle are a, b and c, and the corresponding three angles are A, B and C, then the cosine of the angle A is:
  • the denominator represents the length of two vectors, and the numerator represents the inner product of two vectors.
  • the feature vector of the target interface screenshot X and the feature vector of the normal interface screenshot Y are: x1, x2, ..., x10 and y1, y2, ..., y10, respectively.
  • the cosine distance between them can be expressed by the cosine of the angle between them:
  • FIG. 4 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present disclosure.
  • the difference between the embodiment corresponding to FIG. 1 is that if the cosine distance is determined to exceed the preset threshold, acquiring the level and position of each element control of the user interface to be detected may include S405.
  • S401 to S404 are the same as S101 to S104 in the previous embodiment, and S406 to S407 are the same as S106 to S107 in the previous embodiment.
  • S405 may include S4051 to S4052:
  • S4052 Acquire a level and a position of each element control of the user interface to be detected in real time according to the running state obtaining command.
  • the running state obtaining command is generated by the SDK, and the level and position information of each element control of the user interface to be detected is obtained in real time according to the running state obtaining command (returning the rectangular coordinates of the upper left and lower right coordinate points), which is simple and convenient. Speed up subsequent processing.
  • FIG. 5 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application.
  • the detecting whether the level and position of each of the element controls are abnormal may include S506.
  • S501 to S505 are the same as S101 to S105 in the previous embodiment, and S507 is the same as S107 in the previous embodiment.
  • S506 may include S5061 ⁇ S5062:
  • S5061 Determine, according to a level of each of the element controls, a child control in each of the element controls, and a parent control corresponding to the child control.
  • S5062 detecting whether a location of the target sub-control is set at a front end of the target parent control corresponding to the target sub-control, and detecting whether a range occupied by the target sub-control exceeds a range occupied by the target parent control, the target sub-control To determine any of the child controls in the child controls in each of the described element controls.
  • the control one and the second control are taken as an example, the second control is a child control of the control one, the control one is the parent control of the second control, the second control is the front end of the control one, and the control one is a rectangular frame, and the position is (x1, y1) ) (x2, y2), representing the lower left and lower right corners of the rectangle, and the second control is also a rectangle with a position of (x3, y3) (x4, y4).
  • the detection rule corresponding to the user interface to be detected may be: the child control is set at the front end of the parent control, and the range of the child control cannot exceed the range occupied by the parent control. That is, the above control 2 is at the front end of the control, and x3>x1, x4 ⁇ x2, y1>y3, y2 ⁇ y4 meet the rule, otherwise the display of the user interface to be detected has a problem.
  • FIG. 6 is a schematic diagram showing the operating environment of the user interface display recognition program provided by the embodiment of the present application.
  • the user interface display recognition program 600 is installed and runs in the terminal device 60.
  • the terminal device 60 can be a mobile terminal, a palmtop computer, a server, or the like.
  • the terminal device 60 can include, but is not limited to, a memory 601, a processor 602, and a display 603.
  • FIG. 7 is a functional block diagram of the user interface display recognition program 600 provided by the embodiment of the present application.
  • the user interface display identification device provided by the embodiment of the present application may also include these functional modules.
  • the user interface display recognition program 600 may be divided into one or more modules, the one or more modules being stored in the memory 601 and being processed by one or more processors ( This embodiment is performed by the processor 602) to complete the application.
  • the user interface display recognition program 600 can be divided into a first screenshot processing unit 701, a second screenshot processing unit 702, a cosine distance determining unit 703, a cosine distance determining unit 704, and an element control acquiring unit. 705.
  • the first screenshot processing unit 701 is configured to acquire a target interface screenshot of the user interface to be detected, and extract a feature vector of the target interface screenshot.
  • the second screenshot processing unit 702 is configured to acquire a normal interface screenshot of the pre-stored normal user interface, and extract a feature vector of the normal interface screenshot.
  • the cosine distance determining unit 703 is configured to determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot.
  • the cosine distance determining unit 704 is configured to determine whether the cosine distance exceeds a preset threshold.
  • the element control obtaining unit 705 is configured to acquire a level and a position of each element control of the user interface to be detected if it is determined that the cosine distance exceeds the preset threshold.
  • the element control detecting unit 706 is configured to detect whether the level and position of each of the element controls are abnormal.
  • the user interface display determining unit 707 is configured to determine that the user interface to be detected is displayed normally if it is detected that the level and position of each of the element controls are normal.
  • the first screenshot processing unit 701 may be divided into a sample selecting unit 7011, a first matrix forming unit 7012, a second matrix obtaining unit 7013, and a feature vector determining unit 7014.
  • the sample selection unit 7011 is configured to acquire a screenshot of the target interface of the user interface to be detected, select a first preset number of samples from the target interface screenshot, and extract a second preset number of features for each sample.
  • the first matrix constituting unit 7012 is configured to form a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample.
  • the second matrix obtaining unit 7013 is configured to obtain a second matrix according to the first matrix and the transposed matrix of the first matrix.
  • the feature vector determining unit 7014 is configured to calculate a feature vector of the second matrix, and determine a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  • the cosine distance determining unit 703 may be divided into a vector length calculating unit 7031, a vector inner product obtaining unit 7032, and a cosine distance processing unit 7033.
  • the vector length calculation unit 7031 is configured to separately calculate a feature vector of the target interface screenshot and a length of the feature vector of the normal interface screenshot.
  • the vector inner product obtaining unit 7032 is configured to obtain an inner product of the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot.
  • a cosine distance processing unit 7033 configured to determine a cosine of the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product distance.
  • the element control obtaining unit 705 may be divided into a command generating unit 7051 and an element control processing unit 7052.
  • the command generating unit 7051 is configured to generate an operation state acquisition command through the SDK if it is determined that the cosine distance exceeds the preset threshold.
  • the element control processing unit 7052 is configured to acquire, in real time, the level and position of each element control of the user interface to be detected according to the running state acquisition command.
  • the element control detecting unit 706 may also be divided into a child-parent control determining unit 7061 and a child-parent control detecting unit 7062.
  • the child control determining unit 7061 is configured to determine, according to the level of each of the element controls, a child control in each of the element controls, and a parent control corresponding to the child control.
  • the child control detection unit 7062 is configured to detect whether the position of the target child control is set at the front end of the target parent control corresponding to the target child control, and detect whether the target child control occupies a range beyond the target parent control Range, the target child control is any one of the child controls in each of the determined element controls.
  • the present application implements all or part of the processes in the above embodiments, and may also be completed by a computer program to instruct related hardware.
  • the computer program may be stored in a computer readable storage medium, and the computer program is in the processor. When executed, the steps of the various method embodiments described above can be implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application relates to the field of mobile terminal technology, providing a user interface display identification method, a terminal device, a computer readable storage medium and an apparatus. The method comprises: acquiring a target interface screenshot of a user interface to undergo detection and extracting a feature vector of the target interface screenshot; acquiring a normal interface screenshot of a pre-saved normal user interface and extracting a feature vector of the normal interface screenshot; determining, on the basis of the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot, a cosine distance between the target interface screenshot and the normal interface screenshot; determining whether the cosine distance exceeds a preset threshold; if the cosine distance exceeds the preset threshold, then acquiring the level and position of each basic control component of the user interface; detecting whether the level and position of each basic control component are normal; and if the detected level and position of each basic control component are normal, then determining that the user interface is displaying normally, thereby resolving the issue of a conventional user interface display detection method in which script maintenance efficiency is low.

Description

用户界面显示识别方法、终端设备、存储介质及装置User interface display identification method, terminal device, storage medium and device
本申请要求于2018年1月12日提交中国专利局、申请号为201810029553.8、发明名称为“用户界面显示识别方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201810029553.8, filed on Jan. 12, 2018, entitled "User Interface Display Identification Method and Terminal Device", the entire contents of which are incorporated herein by reference. in.
技术领域Technical field
本申请属于移动终端技术领域,尤其涉及一种用户界面显示识别方法、终端设备、计算机可读存储介质及装置。The present application belongs to the field of mobile terminal technologies, and in particular, to a user interface display and identification method, a terminal device, a computer readable storage medium, and a device.
背景技术Background technique
目前,手机等移动终端上可以应用多种操作系统,例如Android操作系统,由于不同机型的手机分辨率不同,多种操作系统应用于不同分辨率的手机,必须与不同分辨率的手机相适配,才能使用户界面正常显示。现有检测用户界面显示是通过测试脚本进行检测,即执行整个测试脚本,测试完成后将测试结果与设定的固定值进行比较,如果两者一致,测试用户界面显示正常,否则,测试用户界面显示不正常。但是现有检测方法存在脚本维护效率低的问题,如果用户界面有调整,需要重写整个测试case,同时也需要重新设定固定值,测试成本高,不适合实际应用。At present, mobile phones and other mobile terminals can be applied to a variety of operating systems, such as the Android operating system. Since different models of mobile phones have different resolutions, multiple operating systems are applied to mobile phones of different resolutions, and must be compatible with mobile phones of different resolutions. In order to make the user interface display properly. The existing detection user interface display is detected by the test script, that is, the entire test script is executed, and the test result is compared with the set fixed value after the test is completed. If the two are consistent, the test user interface is displayed normally, otherwise, the test user interface is tested. The display is not normal. However, the existing detection method has the problem of low script maintenance efficiency. If the user interface is adjusted, the entire test case needs to be rewritten, and the fixed value needs to be reset again, and the test cost is high, which is not suitable for practical application.
技术问题technical problem
本申请实施例提供一种用户界面显示识别方法、终端设备、计算机可读存储介质及装置,以解决现有用户界面显示检测方法存在的脚本维护效率低的问题。The embodiment of the present invention provides a user interface display and identification method, a terminal device, a computer readable storage medium, and a device, so as to solve the problem that the script maintenance efficiency of the existing user interface display detection method is low.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种用户界面显示识别方法,包括:A first aspect of the embodiment of the present application provides a user interface display and identification method, including:
获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量;Obtaining a screenshot of the target interface of the user interface to be detected, and extracting a feature vector of the screenshot of the target interface;
获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量;Obtaining a normal interface screenshot of the pre-stored normal user interface, and extracting a feature vector of the normal interface screenshot;
根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离;Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot;
判断所述余弦距离是否超过预设阈值;Determining whether the cosine distance exceeds a preset threshold;
若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置;If it is determined that the cosine distance exceeds the preset threshold, acquiring a level and a position of each element control of the user interface to be detected;
检测各个所述元素控件的层级及位置是否异常;Detecting whether the level and position of each of the element controls are abnormal;
若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。If it is detected that the level and position of each of the element controls are normal, it is determined that the user interface to be detected is displayed normally.
本申请实施例的第二方面提供了一种用户界面显示识别终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述用户界面显示识别方法的步骤。A second aspect of the embodiments of the present application provides a user interface display identifying terminal device, including a memory, a processor, and a computer program stored in the memory and operable on the processor, the processor executing the The steps of the above user interface display identification method are implemented when the computer program is described.
本申请实施例的第三方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述用户界面显示识别方法的步骤。A third aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the steps of the user interface display identification method.
本申请实施例的第四方面提供了一种用户界面显示识别装置,可以包括用于实现上述用户界面显示识别方法的步骤的模块。A fourth aspect of the embodiments of the present application provides a user interface display identification apparatus, which may include a module for implementing the steps of the user interface display identification method.
有益效果Beneficial effect
本申请实施例与现有技术相比存在的有益效果是:本申请实施例通过获取待检测用户界面的目标界面截图,确定目标界面截图与正常界面截图的余弦距离,在判定该余弦距离超过预设阈值时,检测待检测用户界面的各个元素控件的层级及位置是否异常,在检测都正常时,判定待检测用户界面显示正常,解决现有用户界面显示检测方法存在的脚本维护效率低的问题,同时结合待检测用户界面的截图和待检测用户界面的各个元素控件的层级及位置,检测用户界面是否异常显示,提高用户界面显示识别准确率,降低测试成本,适合实际应用。Compared with the prior art, the embodiment of the present application has the following beneficial effects: the embodiment of the present application determines the cosine distance between the target interface screenshot and the normal interface screenshot by acquiring a target interface screenshot of the user interface to be detected, and determines that the cosine distance exceeds the pre-predetermined When the threshold is set, it is detected whether the level and position of each element control of the user interface to be detected are abnormal. When the detection is normal, it is determined that the user interface to be detected is displayed normally, and the problem that the existing user interface display detection method has low script maintenance efficiency is solved. At the same time, combining the screenshot of the user interface to be detected and the level and position of each element control of the user interface to be detected, detecting whether the user interface is abnormally displayed, improving the accuracy of the user interface display recognition, reducing the test cost, and being suitable for practical applications.
附图说明DRAWINGS
图1是本申请实施例提供的一种用户界面显示识别方法的示意流程图;1 is a schematic flowchart of a user interface display and identification method provided by an embodiment of the present application;
图2是本申请另一实施例提供的一种用户界面显示识别方法的示意流程图;2 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application;
图3是本申请再一实施例提供的一种用户界面显示识别方法的示意流程图;FIG. 3 is a schematic flowchart of a user interface display and identification method according to still another embodiment of the present application; FIG.
图4是本申请又一实施例提供的一种用户界面显示识别方法的示意流程图;4 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application;
图5是本申请又一实施例提供的一种用户界面显示识别方法的示意流程图;FIG. 5 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application; FIG.
图6是本申请实施例提供的一种用户界面显示识别程序的示意性框图;FIG. 6 is a schematic block diagram of a user interface display recognition program according to an embodiment of the present application; FIG.
图7是本申请实施例提供的一种用户界面显示识别终端设备的示意性框图。FIG. 7 is a schematic block diagram of a user interface display and identification terminal device provided by an embodiment of the present application.
本发明的实施方式Embodiments of the invention
参见图1,图1是本申请实施例提供的一种用户界面显示识别方法的示意流程图,在该实施例中,以终端的角度触发为例进行说明,这里,终端可以为智能手机、平板电脑等移动终端。如图1所示,在该实施例中,终端的处理过程可以包括以下步骤:Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a user interface display and identification method according to an embodiment of the present disclosure. In this embodiment, an angle trigger of a terminal is used as an example. Here, the terminal may be a smart phone or a tablet. Mobile terminals such as computers. As shown in FIG. 1, in this embodiment, the processing of the terminal may include the following steps:
S101:获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量。S101: Obtain a target interface screenshot of the user interface to be detected, and extract a feature vector of the target interface screenshot.
这里,待检测用户界面为任意一个需要检测的用户界面,用户界面也可以称为使用者界面,是系统和用户之间进行交互和信息交换的媒介,它实现信息的内部形式与 人类可以接受形式之间的转换。Here, the user interface to be detected is any user interface that needs to be detected, and the user interface may also be referred to as a user interface, which is a medium for interaction and information exchange between the system and the user, and realizes an internal form of information and a human acceptable form. The conversion between.
获取待检测用户界面的目标界面截图的方式可以为实时获取,也可以为在预设时间获取,具体获取方式可以根据实际需要设置。在获取待检测用户界面的目标界面截图之后,可以显示获取的目标界面截图,还可以生成是否重新获取截图的提示,若接收到重新获取截图请求,根据该请求重新获取待检测用户界面的目标界面截图,可以通过多次获取待检测用户界面的目标界面截图,从获取的多个目标界面截图中选择一个符合要求的目标界面截图,例如选择画面最清晰的目标界面截图。The method for obtaining the screenshot of the target interface of the user interface to be detected may be obtained in real time or acquired in a preset time. The specific acquisition mode may be set according to actual needs. After obtaining the screenshot of the target interface of the user interface to be detected, the obtained target interface screenshot may be displayed, and a prompt for re-acquiring the screenshot may be generated. If the re-acquisition of the screenshot request is received, the target interface of the user interface to be detected is re-acquired according to the request. The screenshot can be obtained by taking a screenshot of the target interface of the user interface to be detected multiple times, and selecting a target interface screenshot that meets the requirements from the obtained plurality of target interface screenshots, for example, selecting the clearest target interface screenshot.
在提取所述目标界面截图的特征向量之后,可以保存提取的特征向量,方便后续数据查询。After extracting the feature vector of the target interface screenshot, the extracted feature vector may be saved to facilitate subsequent data query.
S102:获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量。S102: Obtain a normal interface screenshot of the pre-stored normal user interface, and extract a feature vector of the normal interface screenshot.
具体地,获取预存的正常用户界面的方式包括:可以预先存储用户界面类型与正常用户界面的对应关系,获取待检测用户界面的类型,根据上述关系确定获取的类型对应的正常用户界面。Specifically, the manner of obtaining the pre-stored normal user interface includes: pre-storing the correspondence between the user interface type and the normal user interface, obtaining the type of the user interface to be detected, and determining the normal user interface corresponding to the acquired type according to the foregoing relationship.
上述预存的正常用户界面也可以由获取待检测用户界面正常显示时的界面确定。The pre-stored normal user interface may also be determined by an interface when the user interface to be detected is normally displayed.
获取预存的正常用户界面的正常界面截图的方式与获取待检测用户界面的目标界面截图的方式相同,可以为实时获取,也可以为在预设时间获取。这里,也可以通过多次获取预存的正常用户界面的正常界面截图,从获取的多个正常界面截图中选择一个符合要求的正常界面截图。The manner of obtaining the screenshot of the normal interface of the pre-stored normal user interface is the same as the way of obtaining the screenshot of the target interface of the user interface to be detected, which may be acquired in real time or acquired at a preset time. Here, it is also possible to obtain a normal interface screenshot that meets the requirements from the obtained multiple normal interface screenshots by acquiring the normal interface screenshot of the pre-stored normal user interface multiple times.
S103:根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离。S103: Determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot.
这里,余弦距离,也称为余弦相似度,是用向量空间中两个向量夹角的余弦值作为衡量两个个体间差异的大小的度量。Here, the cosine distance, also called cosine similarity, is a measure of the magnitude of the difference between two individuals using the cosine of the angles of the two vectors in the vector space.
向量,是多维空间中有方向的线段,如果两个向量的方向一致,即夹角接近零,那么这两个向量就相近。A vector is a directional line segment in a multidimensional space. If the directions of the two vectors are the same, that is, the angle is close to zero, then the two vectors are similar.
S104:判断所述余弦距离是否超过预设阈值。S104: Determine whether the cosine distance exceeds a preset threshold.
具体地,预设阈值根据实际需要设置,若上述余弦距离超过该预设阈值,执行步骤S105,若上述余弦距离未超过该预设阈值,可以直接判定上述待检测用户界面显示异常,进一步可以通过报警进行提醒。Specifically, the preset threshold is set according to an actual requirement. If the cosine distance exceeds the preset threshold, step S105 is performed. If the cosine distance does not exceed the preset threshold, the user interface to be detected may be directly determined to be abnormal. The alarm is reminded.
上述通过余弦距离判定上述待检测用户界面显示异常,针对的是待检测用户界面显示异常比较大的情况,这是因为上述在获取待检测用户界面的目标界面截图后,提 取了目标界面截图的特征向量,即根据图像的特征向量进行后续图像显示异常判断,特征向量是图像的整体特征,这种判断方式在待检测用户界面显示异常比较小的情况下,即在判定上述余弦距离超过预设阈值时,容易出现误判,因此在判定上述余弦距离超过预设阈值时要执行后续检测步骤。The above-mentioned abnormality of the user interface to be detected is determined by the cosine distance, and the abnormality of the user interface to be detected is relatively large, because the above-mentioned screenshot of the target interface of the user interface to be detected is extracted, and the feature of the target interface screenshot is extracted. Vector, that is, the subsequent image display abnormality judgment is performed according to the feature vector of the image, and the feature vector is an overall feature of the image. This judgment mode determines that the cosine distance exceeds a preset threshold when the abnormality of the display of the user interface to be detected is relatively small. When a misjudgment is apt to occur, a subsequent detection step is performed when it is determined that the cosine distance exceeds a preset threshold.
S105:若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置。S105: If it is determined that the cosine distance exceeds the preset threshold, acquiring a level and a position of each element control of the user interface to be detected.
这里,上述待检测用户界面的各个元素控件的层级可以包括Mac中的应用、浏览器、iOS APP等。Here, the level of each element control of the above-mentioned user interface to be detected may include an application in a Mac, a browser, an iOS APP, and the like.
获取所述待检测用户界面的各个元素控件的层级及位置可以在自动化测试过程中或者在多机兼容性测试过程中获取。Obtaining the hierarchy and location of each element control of the user interface to be detected may be obtained during an automated testing process or during a multi-machine compatibility testing process.
S106:检测各个所述元素控件的层级及位置是否异常。S106: Detect whether the level and position of each of the element controls are abnormal.
具体地,可以预设用户界面类型与异常控件检测规则的对应关系,获取待检测用户界面的类型,根据上述关系确定获取的待检测用户界面的类型对应的异常控件检测规则,根据该异常控件检测规则检测上述各个元素控件的层级及位置是否异常。Specifically, the corresponding relationship between the user interface type and the abnormal control detection rule may be preset, the type of the user interface to be detected is obtained, and the abnormal control detection rule corresponding to the type of the user interface to be detected is determined according to the foregoing relationship, and the abnormal control is detected according to the abnormality control. The rule detects whether the level and position of each of the above element controls are abnormal.
S107:若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。S107: If it is detected that the level and position of each of the element controls are normal, it is determined that the user interface to be detected is displayed normally.
这里,若检测到各个所述元素控件的层级中有一个或多个元素控件的层级异常,则判定所述待检测用户界面显示异常,可以生成第一异常信息,进一步也可以根据第一异常信息生成第一报警信息,根据第一报警信息进行报警。若检测到各个所述元素控件的位置中有一个或多个元素控件的位置异常,则判定所述待检测用户界面显示异常,可以生成第二异常信息,进一步也可以根据第二异常信息生成第二报警信息,根据第二报警信息进行报警。Here, if it is detected that there is a layer abnormality of one or more element controls in the hierarchy of each of the element controls, it is determined that the user interface to be detected displays an abnormality, and the first abnormality information may be generated, and may further be based on the first abnormality information. The first alarm information is generated, and the alarm is performed according to the first alarm information. If it is detected that the position of the one or more element controls in the position of each of the element controls is abnormal, determining that the user interface to be detected displays an abnormality, may generate a second abnormality information, and further may generate a second abnormal information according to the second abnormality information. Second, the alarm information is alarmed according to the second alarm information.
从以上描述可知,本申请实施例的用户界面显示识别方法,可以解决现有用户界面显示检测方法存在的脚本维护效率低的问题,同时由于通过待检测用户界面的截图可以检测待检测用户界面比较大的异常显示,结合待检测用户界面的各个元素控件的层级及位置可以进一步检测用户界面比较小的异常显示,提高了用户界面显示识别准确率,降低测试成本,适合实际应用。It can be seen from the above description that the user interface display identification method in the embodiment of the present application can solve the problem that the script maintenance efficiency of the existing user interface display detection method is low, and at the same time, the user interface to be detected can be detected through the screenshot of the user interface to be detected. The large anomaly display, combined with the level and position of each element control of the user interface to be detected, can further detect the abnormal display of the user interface, improve the accuracy of the user interface display recognition, reduce the test cost, and is suitable for practical applications.
请参阅图2,图2是本申请另一实施例提供的一种用户界面显示识别方法的示意流程图。与图1对应的实施例的区别在于:所述获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量可以包括S201。其中S202~S207与上一实施例中的S102~S107相同,具体请参阅上述实施例中S102~S107的相关描述,此处不赘述。具 体地,S201可以包括S2011~S2014:Referring to FIG. 2, FIG. 2 is a schematic flowchart of a user interface display identification method according to another embodiment of the present application. The difference between the embodiment corresponding to FIG. 1 is that the acquiring a target interface screenshot of the user interface to be detected, and extracting the feature vector of the target interface screenshot may include S201. S202 to S207 are the same as S102 to S107 in the previous embodiment. For details, refer to the related descriptions of S102 to S107 in the foregoing embodiment, and details are not described herein. Specifically, S201 may include S2011 to S2014:
S2011:获取待检测用户界面的目标界面截图,从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个特征。S2011: Obtain a target interface screenshot of the user interface to be detected, select a first preset number of samples from the target interface screenshot, and extract a second preset number of features for each sample.
这里,第一预设数目和第二预设数目可以根据实际需要设置,例如可以从获取的截图中选取m个样本,每个样本提取n个特征。Here, the first preset number and the second preset number may be set according to actual needs, for example, m samples may be selected from the acquired screenshots, and n features are extracted for each sample.
S2012:根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵。S2012: Form a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample.
具体地,以上述从获取的截图中选取m个样本,每个样本提取n个特征为例,可以将每个样本作为一行,构成m*n的第一矩阵A。Specifically, taking m samples from the acquired screenshots, and extracting n features for each sample as an example, each sample may be taken as one row to form a first matrix A of m*n.
S2013:根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵。S2013: Obtain a second matrix according to the first matrix and the transposed matrix of the first matrix.
这里,可以将第一矩阵的矩阵转置再乘以原矩阵得到第二矩阵C=A(t)*A。Here, the matrix of the first matrix can be transposed and multiplied by the original matrix to obtain a second matrix C=A(t)*A.
S2014:计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。S2014: Calculate a feature vector of the second matrix, and determine a feature vector of the target interface screenshot according to the feature vector of the second matrix.
具体地,求出上述矩阵C的特征向量,该特征向量即为截图的特征向量。Specifically, the feature vector of the matrix C is obtained, and the feature vector is the feature vector of the screenshot.
这里,通过从目标界面截图中选取样本,从每个样本提取特征,获得目标界面截图的特征向量,方法简单,获得的结果准确,适合应用。Here, by selecting samples from the target interface screenshots, extracting features from each sample, and obtaining feature vectors of the target interface screenshots, the method is simple, the obtained results are accurate, and are suitable for application.
请参阅图3,图3是本申请再一实施例提供的一种用户界面显示识别方法的示意流程图。与图1对应的实施例的区别在于:所述根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离可以包括S303。其中S301~S302与上一实施例中的S101~S102相同,S304~S307与上一实施例中的S104~S107相同,具体请参阅上述实施例中S101~S102、S104~S107的相关描述,此处不赘述。具体地,S303可以包括S3031~S3033:Please refer to FIG. 3. FIG. 3 is a schematic flowchart of a user interface display identification method according to another embodiment of the present application. The difference between the embodiment corresponding to FIG. 1 is that: according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot, determining that the cosine distance of the target interface screenshot and the normal interface screenshot may include S303 . S301 to S302 are the same as S101 to S102 in the previous embodiment, and S304 to S307 are the same as S104 to S107 in the previous embodiment. For details, refer to the descriptions of S101 to S102 and S104 to S107 in the above embodiment. I will not go into details. Specifically, S303 may include S3031 to S3033:
S3031:分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度。S3031: Calculate a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot, respectively.
S3032:获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积。S3032: Obtain an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot.
S3033:根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。S3033: Determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the length of the feature vector of the target interface screenshot, the length of the feature vector of the normal interface screenshot, and the inner product.
具体地,余弦定理描述了三角形中任何一个夹角和三个边的关系。给定三角形的三条边,可以使用余弦定理求出三角形各个角的角度。假定三角形的三条边为a,b和c,对应的三个角为A,B和C,那么角A的余弦为:Specifically, the cosine theorem describes the relationship between any one of the triangles and the three sides. Given the three sides of a triangle, you can use the cosine theorem to find the angle of each corner of the triangle. Assuming that the three sides of the triangle are a, b and c, and the corresponding three angles are A, B and C, then the cosine of the angle A is:
Figure PCTCN2018097518-appb-000001
Figure PCTCN2018097518-appb-000001
如果将三角形的两边b和c看成是两个向量,则上述公式等价于:If the two sides b and c of a triangle are treated as two vectors, the above formula is equivalent to:
Figure PCTCN2018097518-appb-000002
Figure PCTCN2018097518-appb-000002
其中分母表示两个向量的长度,分子表示两个向量的内积。The denominator represents the length of two vectors, and the numerator represents the inner product of two vectors.
举一个具体的例子,假如目标界面截图X的特征向量和正常界面截图Y的特征向量分别是:x1,x2,...,x10和y1,y2,...,y10。As a concrete example, if the feature vector of the target interface screenshot X and the feature vector of the normal interface screenshot Y are: x1, x2, ..., x10 and y1, y2, ..., y10, respectively.
则,它们之间的余弦距离可以用它们之间夹角的余弦值来表示:Then, the cosine distance between them can be expressed by the cosine of the angle between them:
Figure PCTCN2018097518-appb-000003
Figure PCTCN2018097518-appb-000003
当两个截图的向量夹角余弦等于1时,这两个截图完全重复,当夹角的余弦值接近于1时,两个截图相似,夹角的余弦越小,两个截图越不相关。When the vector angle cosine of the two screenshots is equal to 1, the two screenshots are completely repeated. When the cosine of the angle is close to 1, the two screenshots are similar, and the smaller the cosine of the angle is, the less relevant the two screenshots are.
请参阅图4,图4是本申请又一实施例提供的一种用户界面显示识别方法的示意流程图。与图1对应的实施例的区别在于:所述若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置可以包括S405。其中S401~S404与上一实施例中的S101~S104相同,S406~S407与上一实施例中的S106~S107相同,具体请参阅上述实施例中S101~S104、S106~S107的相关描述,此处不赘述。具体地,S405可以包括S4051~S4052:Please refer to FIG. 4. FIG. 4 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present disclosure. The difference between the embodiment corresponding to FIG. 1 is that if the cosine distance is determined to exceed the preset threshold, acquiring the level and position of each element control of the user interface to be detected may include S405. S401 to S404 are the same as S101 to S104 in the previous embodiment, and S406 to S407 are the same as S106 to S107 in the previous embodiment. For details, refer to the descriptions of S101 to S104 and S106 to S107 in the above embodiment. I will not go into details. Specifically, S405 may include S4051 to S4052:
S4051:若判定所述余弦距离超过所述预设阈值,则通过SDK生成运行状态获取命令。S4051: If it is determined that the cosine distance exceeds the preset threshold, an operation state acquisition command is generated by using an SDK.
S4052:根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级及位置。S4052: Acquire a level and a position of each element control of the user interface to be detected in real time according to the running state obtaining command.
这里,通过SDK生成运行状态获取命令,根据该运行状态获取命令实时获取待检测用户界面的各个元素控件的层级及位置信息(返回左上和右下两个坐标点的矩形坐标),简单、方便,加快后续处理。Here, the running state obtaining command is generated by the SDK, and the level and position information of each element control of the user interface to be detected is obtained in real time according to the running state obtaining command (returning the rectangular coordinates of the upper left and lower right coordinate points), which is simple and convenient. Speed up subsequent processing.
请参阅图5,图5是本申请又一实施例提供的一种用户界面显示识别方法的示意流程图。与图1对应的实施例的区别在于:所述检测各个所述元素控件的层级及位置是否异常可以包括S506。其中S501~S505与上一实施例中的S101~S105相同,S507与上一实施例中的S107相同,具体请参阅上述实施例中S101~S105、S107的相关描述,此处不赘述。具体地,S506可以包括S5061~S5062:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of a user interface display and identification method according to another embodiment of the present application. The difference from the embodiment corresponding to FIG. 1 is that the detecting whether the level and position of each of the element controls are abnormal may include S506. S501 to S505 are the same as S101 to S105 in the previous embodiment, and S507 is the same as S107 in the previous embodiment. For details, refer to the related descriptions of S101 to S105 and S107 in the foregoing embodiment, and details are not described herein. Specifically, S506 may include S5061~S5062:
S5061:根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件。S5061: Determine, according to a level of each of the element controls, a child control in each of the element controls, and a parent control corresponding to the child control.
S5062:检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。S5062: detecting whether a location of the target sub-control is set at a front end of the target parent control corresponding to the target sub-control, and detecting whether a range occupied by the target sub-control exceeds a range occupied by the target parent control, the target sub-control To determine any of the child controls in the child controls in each of the described element controls.
具体地,以控件一、控件二为例,控件二为控件一的子控件,控件一为控件二的母控件,控件二在控件一的前端,控件一为矩形框,位置为(x1,y1)(x2,y2),代表矩形框的左下角和右下角,控件二也为矩形框,位置为(x3,y3)(x4,y4)。上述待检测用户界面对应的检测规则可以为:子控件设置在母控件的前端,子控件所占范围不能超出母控件所占范围。即上述控件二在控件一前端,且x3>x1,x4<x2,y1>y3,y2<y4才符合规则,否则待检测用户界面显示就有问题。Specifically, the control one and the second control are taken as an example, the second control is a child control of the control one, the control one is the parent control of the second control, the second control is the front end of the control one, and the control one is a rectangular frame, and the position is (x1, y1) ) (x2, y2), representing the lower left and lower right corners of the rectangle, and the second control is also a rectangle with a position of (x3, y3) (x4, y4). The detection rule corresponding to the user interface to be detected may be: the child control is set at the front end of the parent control, and the range of the child control cannot exceed the range occupied by the parent control. That is, the above control 2 is at the front end of the control, and x3>x1, x4<x2, y1>y3, y2<y4 meet the rule, otherwise the display of the user interface to be detected has a problem.
这里,通过检测上述各个元素控件的层级及位置是否异常判断待检测用户界面显示是否有问题,由于根据控件位置进行判断,可以找到比较小的界面显示异常,满足实际应用需要。Here, it is determined whether there is a problem in the display of the user interface to be detected by detecting whether the level and position of each element control are abnormal. Because the judgment is based on the position of the control, a relatively small interface display abnormality can be found, which satisfies the actual application needs.
对应于上文实施例所述的用户界面显示识别方法,图6示出了本申请实施例提供的用户界面显示识别程序的运行环境示意图。所述的用户界面显示识别程序600安装并运行于终端设备60中。该终端设备60可以是移动终端、掌上电脑、服务器等。该终端设备60可包括,但不仅限于,存储器601、处理器602及显示器603。Corresponding to the user interface display identification method described in the above embodiment, FIG. 6 is a schematic diagram showing the operating environment of the user interface display recognition program provided by the embodiment of the present application. The user interface display recognition program 600 is installed and runs in the terminal device 60. The terminal device 60 can be a mobile terminal, a palmtop computer, a server, or the like. The terminal device 60 can include, but is not limited to, a memory 601, a processor 602, and a display 603.
请参阅图7,是本申请实施例提供的用户界面显示识别程序600的功能模块图。本申请实施例提供的用户界面显示识别装置也可包括这些功能模块。在本实施例中,所述的用户界面显示识别程序600可以被分割成一个或多个模块,所述一个或者多个模块被存储于所述存储器601中,并由一个或多个处理器(本实施例为所述处理器602)所执行,以完成本申请。例如,在图8中,所述的用户界面显示识别程序600可以被分割成第一截图处理单元701、第二截图处理单元702、余弦距离确定单元703、余弦距离判断单元704、元素控件获取单元705、元素控件检测单元706和用户界面显示判断单元707。Please refer to FIG. 7 , which is a functional block diagram of the user interface display recognition program 600 provided by the embodiment of the present application. The user interface display identification device provided by the embodiment of the present application may also include these functional modules. In this embodiment, the user interface display recognition program 600 may be divided into one or more modules, the one or more modules being stored in the memory 601 and being processed by one or more processors ( This embodiment is performed by the processor 602) to complete the application. For example, in FIG. 8, the user interface display recognition program 600 can be divided into a first screenshot processing unit 701, a second screenshot processing unit 702, a cosine distance determining unit 703, a cosine distance determining unit 704, and an element control acquiring unit. 705. The element control detecting unit 706 and the user interface display determining unit 707.
其中,第一截图处理单元701,用于获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量。第二截图处理单元702,用于获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量。余弦距离确定单元703,用于根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离。余弦距离判断单元704,用于判断所述余弦距离是 否超过预设阈值。元素控件获取单元705,用于若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置。元素控件检测单元706,用于检测各个所述元素控件的层级及位置是否异常。用户界面显示判断单元707,用于若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。The first screenshot processing unit 701 is configured to acquire a target interface screenshot of the user interface to be detected, and extract a feature vector of the target interface screenshot. The second screenshot processing unit 702 is configured to acquire a normal interface screenshot of the pre-stored normal user interface, and extract a feature vector of the normal interface screenshot. The cosine distance determining unit 703 is configured to determine a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot. The cosine distance determining unit 704 is configured to determine whether the cosine distance exceeds a preset threshold. The element control obtaining unit 705 is configured to acquire a level and a position of each element control of the user interface to be detected if it is determined that the cosine distance exceeds the preset threshold. The element control detecting unit 706 is configured to detect whether the level and position of each of the element controls are abnormal. The user interface display determining unit 707 is configured to determine that the user interface to be detected is displayed normally if it is detected that the level and position of each of the element controls are normal.
可选的,所述第一截图处理单元701可以被分割为样品选取单元7011、第一矩阵构成单元7012、第二矩阵获得单元7013和特征向量确定单元7014。Optionally, the first screenshot processing unit 701 may be divided into a sample selecting unit 7011, a first matrix forming unit 7012, a second matrix obtaining unit 7013, and a feature vector determining unit 7014.
其中,样品选取单元7011,用于获取待检测用户界面的目标界面截图,从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个特征。第一矩阵构成单元7012,用于根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵。第二矩阵获得单元7013,用于根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵。特征向量确定单元7014,用于计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。The sample selection unit 7011 is configured to acquire a screenshot of the target interface of the user interface to be detected, select a first preset number of samples from the target interface screenshot, and extract a second preset number of features for each sample. The first matrix constituting unit 7012 is configured to form a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample. The second matrix obtaining unit 7013 is configured to obtain a second matrix according to the first matrix and the transposed matrix of the first matrix. The feature vector determining unit 7014 is configured to calculate a feature vector of the second matrix, and determine a feature vector of the target interface screenshot according to the feature vector of the second matrix.
可选的,所述余弦距离确定单元703可以被分割为向量长度计算单元7031、向量内积获得单元7032和余弦距离处理单元7033。Alternatively, the cosine distance determining unit 703 may be divided into a vector length calculating unit 7031, a vector inner product obtaining unit 7032, and a cosine distance processing unit 7033.
其中,向量长度计算单元7031,用于分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度。向量内积获得单元7032,用于获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积。余弦距离处理单元7033,用于根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。The vector length calculation unit 7031 is configured to separately calculate a feature vector of the target interface screenshot and a length of the feature vector of the normal interface screenshot. The vector inner product obtaining unit 7032 is configured to obtain an inner product of the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot. a cosine distance processing unit 7033, configured to determine a cosine of the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product distance.
可选的,所述元素控件获取单元705可以被分割为命令生成单元7051和元素控件处理单元7052。Optionally, the element control obtaining unit 705 may be divided into a command generating unit 7051 and an element control processing unit 7052.
其中,命令生成单元7051,用于若判定所述余弦距离超过所述预设阈值,则通过SDK生成运行状态获取命令。元素控件处理单元7052,用于根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级及位置。The command generating unit 7051 is configured to generate an operation state acquisition command through the SDK if it is determined that the cosine distance exceeds the preset threshold. The element control processing unit 7052 is configured to acquire, in real time, the level and position of each element control of the user interface to be detected according to the running state acquisition command.
可选的,所述元素控件检测单元706还可以被分割成子母控件确定单元7061和子母控件检测单元7062。Optionally, the element control detecting unit 706 may also be divided into a child-parent control determining unit 7061 and a child-parent control detecting unit 7062.
其中,子母控件确定单元7061,用于根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件。子母控件检测单元7062,用于检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。The child control determining unit 7061 is configured to determine, according to the level of each of the element controls, a child control in each of the element controls, and a parent control corresponding to the child control. The child control detection unit 7062 is configured to detect whether the position of the target child control is set at the front end of the target parent control corresponding to the target child control, and detect whether the target child control occupies a range beyond the target parent control Range, the target child control is any one of the child controls in each of the determined element controls.
本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。The present application implements all or part of the processes in the above embodiments, and may also be completed by a computer program to instruct related hardware. The computer program may be stored in a computer readable storage medium, and the computer program is in the processor. When executed, the steps of the various method embodiments described above can be implemented.

Claims (20)

  1. 一种用户界面显示识别方法,其特征在于,包括:A user interface display identification method, comprising:
    获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量;Obtaining a screenshot of the target interface of the user interface to be detected, and extracting a feature vector of the screenshot of the target interface;
    获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量;Obtaining a normal interface screenshot of the pre-stored normal user interface, and extracting a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离;Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot;
    判断所述余弦距离是否超过预设阈值;Determining whether the cosine distance exceeds a preset threshold;
    若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置;If it is determined that the cosine distance exceeds the preset threshold, acquiring a level and a position of each element control of the user interface to be detected;
    检测各个所述元素控件的层级及位置是否异常;Detecting whether the level and position of each of the element controls are abnormal;
    若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。If it is detected that the level and position of each of the element controls are normal, it is determined that the user interface to be detected is displayed normally.
  2. 如权利要求1所述的用户界面显示识别方法,其特征在于,所述提取所述目标界面截图的特征向量包括:The user interface display identification method according to claim 1, wherein the extracting the feature vector of the target interface screenshot comprises:
    从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个特征;Selecting a first preset number of samples from the target interface screenshot, and extracting a second preset number of features for each sample;
    根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵;Forming a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample;
    根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵;Obtaining a second matrix according to the first matrix and the transposed matrix of the first matrix;
    计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。Calculating a feature vector of the second matrix, and determining a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  3. 如权利要求1所述的用户界面显示识别方法,其特征在于,所述根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离包括:The user interface display identification method according to claim 1, wherein the determining the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot The cosine distance includes:
    分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度;Calculating a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot respectively;
    获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积;Obtaining an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product.
  4. 如权利要求1所述的用户界面显示识别方法,其特征在于,所述获取所述待检测用户界面的各个元素控件的层级及位置包括:The user interface display identification method according to claim 1, wherein the acquiring the level and location of each element control of the user interface to be detected comprises:
    通过软件开发工具包SDK生成运行状态获取命令;Generate a running status acquisition command through the software development kit SDK;
    根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级 及位置。Acquiring the level and location of each element control of the user interface to be detected in real time according to the running state acquisition command.
  5. 如权利要求1所述的用户界面显示识别方法,其特征在于,所述检测各个所述元素控件的层级及位置是否异常包括:The user interface display identification method according to claim 1, wherein the detecting whether the level and position of each of the element controls are abnormal comprises:
    根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件;Determining a child control in each of the element controls according to a level of each of the element controls, and a parent control corresponding to the child control;
    检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。Detecting whether the position of the target child control is set at the front end of the target parent control corresponding to the target child control, and detecting whether the target child control occupies a range beyond the target parent control, and the target child control is determined Any of the child controls in each of the described element controls.
  6. 一种用户界面显示识别终端设备,其特征在于,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如下步骤:A user interface display identification terminal device, comprising: a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein when the processor executes the computer program, the implementation is as follows step:
    获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量;Obtaining a screenshot of the target interface of the user interface to be detected, and extracting a feature vector of the screenshot of the target interface;
    获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量;Obtaining a normal interface screenshot of the pre-stored normal user interface, and extracting a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离;Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot;
    判断所述余弦距离是否超过预设阈值;Determining whether the cosine distance exceeds a preset threshold;
    若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置;If it is determined that the cosine distance exceeds the preset threshold, acquiring a level and a position of each element control of the user interface to be detected;
    检测各个所述元素控件的层级及位置是否异常;Detecting whether the level and position of each of the element controls are abnormal;
    若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。If it is detected that the level and position of each of the element controls are normal, it is determined that the user interface to be detected is displayed normally.
  7. 如权利要求6所述的用户界面显示识别终端设备,其特征在于,所述提取所述目标界面截图的特征向量包括:The user interface display identification terminal device according to claim 6, wherein the extracting the feature vector of the target interface screenshot comprises:
    从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个特征;Selecting a first preset number of samples from the target interface screenshot, and extracting a second preset number of features for each sample;
    根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵;Forming a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample;
    根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵;Obtaining a second matrix according to the first matrix and the transposed matrix of the first matrix;
    计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。Calculating a feature vector of the second matrix, and determining a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  8. 如权利要求6所述的用户界面显示识别终端设备,其特征在于,所述根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与 所述正常界面截图的余弦距离包括:The user interface display identification terminal device according to claim 6, wherein the determining the target interface screenshot and the normal interface according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot The cosine distance of the screenshot includes:
    分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度;Calculating a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot respectively;
    获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积;Obtaining an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product.
  9. 如权利要求6所述的用户界面显示识别终端设备,其特征在于,所述获取所述待检测用户界面的各个元素控件的层级及位置包括:The user interface display and identification terminal device of claim 6, wherein the obtaining the level and location of each element control of the user interface to be detected comprises:
    通过软件开发工具包SDK生成运行状态获取命令;Generate a running status acquisition command through the software development kit SDK;
    根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级及位置。Acquiring the level and location of each element control of the user interface to be detected in real time according to the running state acquisition command.
  10. 如权利要求6所述的用户界面显示识别终端设备,其特征在于,所述检测各个所述元素控件的层级及位置是否异常包括:The user interface display and identification terminal device according to claim 6, wherein the detecting whether the level and position of each of the element controls are abnormal comprises:
    根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件;Determining a child control in each of the element controls according to a level of each of the element controls, and a parent control corresponding to the child control;
    检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。Detecting whether the position of the target child control is set at the front end of the target parent control corresponding to the target child control, and detecting whether the target child control occupies a range beyond the target parent control, and the target child control is determined Any of the child controls in each of the described element controls.
  11. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如下步骤:A computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the following steps:
    获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量;Obtaining a screenshot of the target interface of the user interface to be detected, and extracting a feature vector of the screenshot of the target interface;
    获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量;Obtaining a normal interface screenshot of the pre-stored normal user interface, and extracting a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离;Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot;
    判断所述余弦距离是否超过预设阈值;Determining whether the cosine distance exceeds a preset threshold;
    若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置;If it is determined that the cosine distance exceeds the preset threshold, acquiring a level and a position of each element control of the user interface to be detected;
    检测各个所述元素控件的层级及位置是否异常;Detecting whether the level and position of each of the element controls are abnormal;
    若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。If it is detected that the level and position of each of the element controls are normal, it is determined that the user interface to be detected is displayed normally.
  12. 如权利要求11所述的计算机可读存储介质,其特征在于,所述提取所述目标界面截图的特征向量包括:The computer readable storage medium of claim 11, wherein the extracting the feature vector of the target interface screenshot comprises:
    从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个 特征;Selecting a first preset number of samples from the target interface screenshot, and extracting a second preset number of features for each sample;
    根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵;Forming a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample;
    根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵;Obtaining a second matrix according to the first matrix and the transposed matrix of the first matrix;
    计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。Calculating a feature vector of the second matrix, and determining a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  13. 如权利要求11所述的计算机可读存储介质,其特征在于,所述根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离包括:The computer readable storage medium according to claim 11, wherein the determining the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot The cosine distance includes:
    分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度;Calculating a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot respectively;
    获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积;Obtaining an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot;
    根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。Determining a cosine distance between the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product.
  14. 如权利要求11所述的计算机可读存储介质,其特征在于,所述获取所述待检测用户界面的各个元素控件的层级及位置包括:The computer readable storage medium according to claim 11, wherein the obtaining the level and location of each element control of the user interface to be detected comprises:
    通过软件开发工具包SDK生成运行状态获取命令;Generate a running status acquisition command through the software development kit SDK;
    根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级及位置。Acquiring the level and location of each element control of the user interface to be detected in real time according to the running state acquisition command.
  15. 如权利要求11所述的计算机可读存储介质,其特征在于,所述检测各个所述元素控件的层级及位置是否异常包括:The computer readable storage medium according to claim 11, wherein the detecting whether the level and position of each of the element controls are abnormal comprises:
    根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件;Determining a child control in each of the element controls according to a level of each of the element controls, and a parent control corresponding to the child control;
    检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。Detecting whether the position of the target child control is set at the front end of the target parent control corresponding to the target child control, and detecting whether the target child control occupies a range beyond the target parent control, and the target child control is determined Any of the child controls in each of the described element controls.
  16. 一种用户界面显示识别装置,其特征在于,包括:A user interface display identification device, comprising:
    第一截图处理单元,用于获取待检测用户界面的目标界面截图,提取所述目标界面截图的特征向量;a first screenshot processing unit, configured to acquire a target interface screenshot of the user interface to be detected, and extract a feature vector of the target interface screenshot;
    第二截图处理单元,用于获取预存的正常用户界面的正常界面截图,提取所述正常界面截图的特征向量;a second screenshot processing unit, configured to acquire a normal interface screenshot of the pre-stored normal user interface, and extract a feature vector of the normal interface screenshot;
    余弦距离确定单元,用于根据所述目标界面截图的特征向量和所述正常界面截图的特征向量,确定所述目标界面截图与所述正常界面截图的余弦距离;a cosine distance determining unit, configured to determine a cosine distance of the target interface screenshot and the normal interface screenshot according to the feature vector of the target interface screenshot and the feature vector of the normal interface screenshot;
    余弦距离判断单元,用于判断所述余弦距离是否超过预设阈值;a cosine distance determining unit, configured to determine whether the cosine distance exceeds a preset threshold;
    元素控件获取单元,用于若判定所述余弦距离超过所述预设阈值,则获取所述待检测用户界面的各个元素控件的层级及位置;An element control acquiring unit, configured to acquire a level and a position of each element control of the user interface to be detected if it is determined that the cosine distance exceeds the preset threshold;
    元素控件检测单元,用于检测各个所述元素控件的层级及位置是否异常;An element control detecting unit, configured to detect whether the level and position of each of the element controls are abnormal;
    用户界面显示判断单元,用于若检测到各个所述元素控件的层级及位置均正常,则判定所述待检测用户界面显示正常。The user interface display determining unit is configured to determine that the user interface to be detected is displayed normally if it is detected that the level and position of each of the element controls are normal.
  17. 如权利要求16所述的用户界面显示识别装置,其特征在于,所述第一截图处理单元包括:The user interface display and recognition device of claim 16, wherein the first screenshot processing unit comprises:
    样品选取单元,用于获取待检测用户界面的目标界面截图,从所述目标界面截图中选取第一预设数目个样本,每个样本提取第二预设数目个特征;a sample selection unit, configured to acquire a target interface screenshot of the user interface to be detected, select a first preset number of samples from the target interface screenshot, and extract a second preset number of features for each sample;
    第一矩阵构成单元,用于根据所述第一预设数目个样本和每个样本提取的第二预设数目个特征,构成第一矩阵;a first matrix constituting unit, configured to form a first matrix according to the first preset number of samples and a second preset number of features extracted by each sample;
    第二矩阵获得单元,用于根据所述第一矩阵和所述第一矩阵的转置矩阵获得第二矩阵;a second matrix obtaining unit, configured to obtain a second matrix according to the first matrix and the transposed matrix of the first matrix;
    特征向量确定单元,用于计算所述第二矩阵的特征向量,根据所述第二矩阵的特征向量确定所述目标界面截图的特征向量。And a feature vector determining unit, configured to calculate a feature vector of the second matrix, and determine a feature vector of the target interface screenshot according to the feature vector of the second matrix.
  18. 如权利要求16所述的用户界面显示识别装置,其特征在于,所述余弦距离确定单元包括:The user interface display identification device according to claim 16, wherein the cosine distance determining unit comprises:
    向量长度计算单元,用于分别计算所述目标界面截图的特征向量和所述正常界面截图的特征向量的长度;a vector length calculation unit, configured to separately calculate a feature vector of the target interface screenshot and a length of a feature vector of the normal interface screenshot;
    向量内积获得单元,用于获得所述目标界面截图的特征向量和所述正常界面截图的特征向量的内积;a vector inner product obtaining unit, configured to obtain an inner product of a feature vector of the target interface screenshot and a feature vector of the normal interface screenshot;
    余弦距离处理单元,用于根据所述目标界面截图的特征向量的长度、所述正常界面截图的特征向量的长度和所述内积,确定所述目标界面截图与所述正常界面截图的余弦距离。a cosine distance processing unit, configured to determine a cosine distance between the target interface screenshot and the normal interface screenshot according to a length of a feature vector of the target interface screenshot, a length of a feature vector of the normal interface screenshot, and the inner product .
  19. 如权利要求16所述的用户界面显示识别装置,其特征在于,所述元素控件获取单元包括:The user interface display and recognition device according to claim 16, wherein the element control acquisition unit comprises:
    命令生成单元,用于若判定所述余弦距离超过所述预设阈值,则通过SDK生成运行状态获取命令;a command generating unit, configured to generate an operation state acquisition command through the SDK if it is determined that the cosine distance exceeds the preset threshold;
    元素控件处理单元,用于根据所述运行状态获取命令实时获取所述待检测用户界面的各个元素控件的层级及位置。The element control processing unit is configured to acquire, in real time, the level and position of each element control of the user interface to be detected according to the running state acquisition command.
  20. 如权利要求19所述的用户界面显示识别装置,其特征在于,所述元素控件检 测单元包括:The user interface display and recognition device according to claim 19, wherein the element control detecting unit comprises:
    子母控件确定单元,用于根据各个所述元素控件的层级确定各个所述元素控件中的子控件,以及子控件对应的母控件;a child control unit determining unit is configured to determine a child control in each of the element controls according to a level of each of the element controls, and a parent control corresponding to the child control;
    子母控件检测单元,用于检测目标子控件的位置是否设置在所述目标子控件对应的目标母控件的前端,并检测所述目标子控件所占范围是否超出所述目标母控件所占范围,所述目标子控件为确定的各个所述元素控件中的子控件中任意一个子控件。a child control detection unit is configured to detect whether a position of the target child control is set at a front end of the target parent control corresponding to the target child control, and detect whether the target child control occupies a range beyond the target parent control The target child control is any one of the child controls in each of the determined element controls.
PCT/CN2018/097518 2018-01-12 2018-07-27 User interface display identification method, terminal device, storage medium and apparatus WO2019136961A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810029553.8A CN108363599B (en) 2018-01-12 2018-01-12 User interface shows recognition methods and terminal device
CN201810029553.8 2018-01-12

Publications (1)

Publication Number Publication Date
WO2019136961A1 true WO2019136961A1 (en) 2019-07-18

Family

ID=63011346

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097518 WO2019136961A1 (en) 2018-01-12 2018-07-27 User interface display identification method, terminal device, storage medium and apparatus

Country Status (2)

Country Link
CN (1) CN108363599B (en)
WO (1) WO2019136961A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600995A (en) * 2020-05-15 2020-08-28 上海莉莉丝科技股份有限公司 Mobile device and method for correcting deviation of game user interface of mobile device
CN112686338A (en) * 2021-03-10 2021-04-20 卡斯柯信号(北京)有限公司 Image information identification method, device, equipment and storage medium

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144868B (en) * 2018-08-15 2022-02-01 无线生活(杭州)信息科技有限公司 Page judgment method and device
CN109240923B (en) * 2018-08-31 2021-06-04 福建天泉教育科技有限公司 Interface test script generation method and computer readable storage medium
CN109446061B (en) * 2018-09-17 2022-06-10 平安科技(深圳)有限公司 Page detection method, computer readable storage medium and terminal device
CN111475396A (en) * 2019-01-24 2020-07-31 北京嘀嘀无限科技发展有限公司 Program detection method, device, electronic equipment and storage medium
CN109886431B (en) * 2019-01-25 2021-05-07 北京首都国际机场股份有限公司 Automatic inspection system for airport navigation display terminal
CN109857673B (en) * 2019-02-25 2022-02-15 北京云测信息技术有限公司 Control identification method and device
CN109976854B (en) * 2019-03-22 2023-02-24 维沃移动通信有限公司 Application processing method and terminal equipment
CN110309073B (en) * 2019-06-28 2021-07-27 上海交通大学 Method, system and terminal for automatically detecting user interface errors of mobile application program
CN112231034A (en) * 2019-12-23 2021-01-15 北京来也网络科技有限公司 Software interface element identification method and device combining RPA and AI
CN111880984A (en) * 2020-06-09 2020-11-03 上海容易网电子商务股份有限公司 Monitoring system for android interactive screen application running state

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110235902A1 (en) * 2010-03-29 2011-09-29 Ebay Inc. Pre-computing digests for image similarity searching of image-based listings in a network-based publication system
CN103927480A (en) * 2013-01-14 2014-07-16 腾讯科技(深圳)有限公司 Method, device and system for identifying malicious web page
CN106874753A (en) * 2016-12-30 2017-06-20 中国建设银行股份有限公司 The method and device at the abnormal interface of identification
CN107025174A (en) * 2017-04-06 2017-08-08 网易(杭州)网络有限公司 For the method for the user interface abnormality test of equipment, device and readable storage media
CN107315682A (en) * 2017-06-22 2017-11-03 北京凤凰理理它信息技术有限公司 Test browser-safe method, device, storage medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110235902A1 (en) * 2010-03-29 2011-09-29 Ebay Inc. Pre-computing digests for image similarity searching of image-based listings in a network-based publication system
CN103927480A (en) * 2013-01-14 2014-07-16 腾讯科技(深圳)有限公司 Method, device and system for identifying malicious web page
CN106874753A (en) * 2016-12-30 2017-06-20 中国建设银行股份有限公司 The method and device at the abnormal interface of identification
CN107025174A (en) * 2017-04-06 2017-08-08 网易(杭州)网络有限公司 For the method for the user interface abnormality test of equipment, device and readable storage media
CN107315682A (en) * 2017-06-22 2017-11-03 北京凤凰理理它信息技术有限公司 Test browser-safe method, device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600995A (en) * 2020-05-15 2020-08-28 上海莉莉丝科技股份有限公司 Mobile device and method for correcting deviation of game user interface of mobile device
CN112686338A (en) * 2021-03-10 2021-04-20 卡斯柯信号(北京)有限公司 Image information identification method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN108363599B (en) 2019-07-19
CN108363599A (en) 2018-08-03

Similar Documents

Publication Publication Date Title
WO2019136961A1 (en) User interface display identification method, terminal device, storage medium and apparatus
US20220036648A1 (en) Method and terminal device for determining occluded area of virtual object
JP6815707B2 (en) Face posture detection method, device and storage medium
RU2672181C2 (en) Method and device for team generation
CN105320921B (en) Eyes localization method and eyes positioning device
CN113240769B (en) Spatial link relation identification method and device and storage medium
US20150186004A1 (en) Multimode gesture processing
WO2019223461A1 (en) Touch detection method and computer-readable storage medium
JP2017534123A (en) Operation control method of flexible display device
US9069415B2 (en) Systems and methods for finger pose estimation on touchscreen devices
WO2022002262A1 (en) Character sequence recognition method and apparatus based on computer vision, and device and medium
WO2019019372A1 (en) Picture operation and control method and device for mobile terminal, mobile terminal, and medium
CN105975132B (en) A kind of detection method and device of touch screen accuracy
CN112683169A (en) Object size measuring method, device, equipment and storage medium
JP2014238674A (en) Information processing system, information processing method, and program
CN113467877B (en) Data display system and method
JP2017068465A (en) Information processing device, control method, and program
WO2019090691A1 (en) Monkey testing method and terminal
WO2015176376A1 (en) Method and device for automatically adjusting valid touch point, and computer storage medium
CN111141217A (en) Object measuring method, device, terminal equipment and computer storage medium
CN108984097B (en) Touch operation method and device, storage medium and electronic equipment
EP2975503A2 (en) Touch device and corresponding touch method
CN109614175B (en) User interface exception handling method, device, computer equipment and storage medium
CN114202804A (en) Behavior action recognition method and device, processing equipment and storage medium
US20170185831A1 (en) Method and device for distinguishing finger and wrist

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18899869

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.11.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18899869

Country of ref document: EP

Kind code of ref document: A1