CN104317705B - Object identifying method based on dynamic graphical user interface - Google Patents

Object identifying method based on dynamic graphical user interface Download PDF

Info

Publication number
CN104317705B
CN104317705B CN201410542900.9A CN201410542900A CN104317705B CN 104317705 B CN104317705 B CN 104317705B CN 201410542900 A CN201410542900 A CN 201410542900A CN 104317705 B CN104317705 B CN 104317705B
Authority
CN
China
Prior art keywords
service end
executor
root
lookup result
javascript
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410542900.9A
Other languages
Chinese (zh)
Other versions
CN104317705A (en
Inventor
黄芳
赵晓
曾理志
梁建军
杨崇
商悦
薛乃斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING JOIN-CHEER SOFTWARE CO LTD
Original Assignee
BEIJING JOIN-CHEER SOFTWARE CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING JOIN-CHEER SOFTWARE CO LTD filed Critical BEIJING JOIN-CHEER SOFTWARE CO LTD
Priority to CN201410542900.9A priority Critical patent/CN104317705B/en
Publication of CN104317705A publication Critical patent/CN104317705A/en
Application granted granted Critical
Publication of CN104317705B publication Critical patent/CN104317705B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The present invention provides a kind of object identifying method and device based on dynamic graphical user interface, and described object identifying method includes:The executor of the JavaScript in Selenium is called to obtain root object ID from service end;Function name, object information and described root object ID are sent to into described service end by described executor;The lookup result of the object is obtained by described executor from described service end, described lookup result is generated according to the function name, object information and root object ID by described service end;The object is operated according to described lookup result.By the invention it is possible to solve dynamic GUI Object and recognize less than or recognize inaccurate problem;Object is searched using the form identification for performing JavaScript function, it is in hgher efficiency.

Description

Object identifying method based on dynamic graphical user interface
Technical field
The present invention is, with regard to graphic user interface automatization testing technique, to be based on dynamic graphical user especially with regard to a kind of The object identifying method at interface.
Background technology
The most crucial work of UI automatic tests is to recognize the interface element (object) for wanting to operate, such as one text Frame (Textbox) or a button (Button), it is necessary to will first obtain these objects, can be operated.For static state GUI (Graphical User Interface graphic user interfaces), current existing automated test frame (instrument) pass through Script is first recorded, this can effectively be recognized according to the unique mark (ID) of interface element (object) when playback then Element (object), but for dynamic GUI, because unique mark (ID) is dynamic changing, according to recording when playback When unique mark (ID) go identification just there will be two kinds of situations:(1) object that identification is recognized less than element (object) (2) is not It is intended to the element (object) for operating.
In order to solve the above problems, the web application test of increasing income of the complete set of ThoughtWorks companies exploitation System (Selenium automated test frames (instrument)).The object identifying method having include according to By.id (interface element ID), By.className (ClassName of interface element), By.tagName (tagName of interface element) etc., but Which has as a drawback that:
In addition to By.id (ID of interface element), a unique interface object can not be all recognized, be needed in numerous knowledges Further according to other object properties distinguishing the object for wanting to recognize in other object, recognition efficiency is substantially reduced;
By.id (ID of interface element) effectively can be recognized and efficiency is very high for static GUI, but for dynamic GUI is then recognized less than or is recognized inaccurate.
If page control is in a frame or Iframe, in needing to be introduced into frame or Iframe and then again Make a look up;If frame or iframe are relatively more on interface, need frequently to jump into and jump out.
In order to solve problems of the prior art, a kind of automatic testing instrument (QTP) of Mercury companies exploitation, Its general requirement first defines Warehouse object in object store file, and there is the value of the characteristic attribute of practical object the inside.Then When operation, QTP can find corresponding Warehouse object according to the object name in script in object store.But, its Have as a drawback that:The value of the characteristic attribute of practical object is also the ID or name of object equivalent, for static GUI can have The identification of effect and efficiency is very high, but for dynamic GUI is then recognized less than or is recognized inaccurate.
The content of the invention
The present invention provides a kind of object identifying method and device based on dynamic graphical user interface, to solve prior art Middle dynamic GUI Object is recognized less than or recognizes inaccurate problem.
To achieve these goals, the present invention provides a kind of object identifying method based on dynamic graphical user interface, institute The object identifying method stated includes:
The executor of the JavaScript in Selenium is called to obtain root object ID from service end;
Function name, object information and described root object ID are sent to into described service end by described executor;
The lookup result of the object is obtained by described executor from described service end, described lookup result by Described service end is generated according to the function name, object information and root object ID;
The object is operated according to described lookup result.
In one embodiment, described object information is object type or the corresponding text of object.
In one embodiment, described lookup result includes:The ID of object to be searched or object.
In one embodiment, described object identifying method also includes:Described service is called by described executor End JavaScript function generates described lookup result, and returns described lookup result.
To achieve these goals, the present invention also provides a kind of object recognition equipment based on dynamic graphical user interface, Described object recognition equipment includes:
Root object acquiring unit, for calling the executor of the JavaScript in Selenium to obtain root pair from service end As ID;
Information transmitting unit, for function name, object information and described root object ID are sent out by described executor Give described service end;
Lookup result acquiring unit, for obtaining the lookup of the object by described executor from described service end As a result, described lookup result is generated according to the function name, object information and root object ID by described service end;
Object Operations unit, for operating the object according to described lookup result.
In one embodiment, described object information is object type or the corresponding text of object.
In one embodiment, described lookup result includes:The ID of object to be searched or object.
In one embodiment, described object recognition equipment also includes:Function calling cell, for by described execution Device calls described service end JavaScript function to generate described lookup result, and returns described lookup result.
By the invention it is possible to solve dynamic GUI Object and recognize less than or recognize inaccurate problem;Using execution Object is searched in the form identification of JavaScript function, in hgher efficiency.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also To obtain other accompanying drawings according to these accompanying drawings.
Object identifying method flow charts of the Fig. 1 for the embodiment of the present invention;
Fig. 2 is the flow chart of client acquisition root object ID in the embodiment of the present invention;
The flow chart that Fig. 3 obtains the ID of object to be searched and/or object for client in the embodiment of the present invention;
Structured flowcharts of the Fig. 4 for the object recognition equipment of the embodiment of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than the embodiment of whole.It is based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made Embodiment, belongs to the scope of protection of the invention.
As shown in figure 1, a kind of object identifying method based on dynamic graphical user interface is embodiments provided, should Object identifying method includes:
S101:The executor of the JavaScript in Selenium is called to obtain root object ID from service end;
S102:Function name, object information and described root object ID are sent to into described clothes by described executor Business end;
S103:The lookup result of the object, described lookup are obtained by described executor from described service end As a result generated according to the function name, object information and root object ID by described service end;
S104:The object is operated according to described lookup result.
The executive agent of the object identifying method in Fig. 1 is client, and client can be mobile phone, computer.Client is also Can be IE, such as user carries out web page access by IE is, IE is client, and webpage is service end.
From the flow process of Fig. 1, client is carried out with service end by the executor of the JavaScript in Selenium Information exchange, obtains root object ID from service end for client for the first time twice, and second is that client sends function to service end Name, object information and root object ID, obtain the ID of object to be searched or object.By information exchange twice, can solve Dynamic GUI Object is recognized less than or recognizes inaccurate problem;Searched using the form identification for performing JavaScript function Object, it is in hgher efficiency.
Above-mentioned executor can be provided by Selenium, such as Object executeScript (String script, Object...args)。
When S101 is embodied as, as shown in Fig. 2 client can call the executor of the JavaScript in Selenium Root object ID is sent to service end and obtains solicited message, to obtain the root object ID of whole GUI, that is, obtain corresponding Body labels (can be obtained according to the By.tagName (" body ") of Selenium).After service end receives root object ID acquisition solicited messages, Root object ID is sent to client by above-mentioned executor.Client can be eventually through the JavaScript's in Selenium Executor obtains root object ID from service end.
After client obtains root object ID, S102 and S103 will be carried out, function name, object information and root object ID will be led to Cross above-mentioned executor and be sent to service end.In one embodiment, the object information is object type or the corresponding text of object This.Object type is class attributes, and the corresponding text of object is Text attributes.When being embodied as, as shown in figure 3, client to Above-mentioned executor sends function name, object information and root object ID, and executor receives function name, object information and root object ID Afterwards, function name, object information and root object ID are sent to into service end.
Client can include the function name of multiple functions to the function name that service end sends, such as including two functions Name, first is object, second ID for object.For first function name, client it is to be searched for object, for Two function names, the client ID for object to be searched.
The executor of JavaScript can call the JavaScript function for performing service end, service end JavaScript function will provide element corresponding object type according to the function name, object information and root object ID that receive (class attributes) or the corresponding text of object (Text attributes) search the JavaScript function of object, pass through JavaScript function, generates lookup result, and returns lookup result, i.e., return object to be searched to above-mentioned executor The ID (second function name of correspondence) of (first function name of correspondence) or object.Above-mentioned executor is by object to be searched And/or the ID of object passes to client.
After client receives the ID of object to be searched and/or object, it is possible to according to described lookup result The object is operated, for example, the operation such as can carry out clicking on, move, be input into.
By the object identifying method of the present invention, dynamic GUI Object can be solved and recognized less than or recognized inaccurate Problem;Object is searched using the form identification for performing JavaScript function, it is in hgher efficiency.
As shown in figure 4, the present invention provides a kind of object recognition equipment based on dynamic graphical user interface, its object is known Other device includes:Root object acquiring unit 401, information transmitting unit 402, lookup result acquiring unit 403 and Object Operations list Unit 404.
Root object acquiring unit 401 obtains root from service end for calling the executor of the JavaScript in Selenium Object ID.When S101 is embodied as, root object acquiring unit 401 can call the executor of the JavaScript in Selenium Root object ID is sent to service end and obtains solicited message, to obtain the root object ID of whole GUI, that is, obtain corresponding Body labels (can be obtained according to the By.tagName (" body ") of Selenium).After service end receives root object ID acquisition solicited messages, Root object ID is sent to client by above-mentioned executor.Client can be eventually through the JavaScript's in Selenium Executor obtains root object ID from service end.
Information transmitting unit 402 for by function name, object information and described root object ID pass through described executor It is sent to described service end.Lookup result acquiring unit 403 is used to obtain from described service end by described executor The lookup result of the object, described lookup result is by described service end according to the function name, object information and root pair As ID is generated.After client obtains root object ID, function name, object information and root object ID are sent out by above-mentioned executor Give service end.In one embodiment, the object information is object type or the corresponding text of object.Object type is Class attributes, the corresponding text of object are Text attributes.When being embodied as, client sends function name, right to above-mentioned executor Image information and root object ID, after executor receives function name, object information and root object ID, by function name, object information And root object ID is sent to service end.
Client can include the function name of multiple functions to the function name that service end sends, such as including two functions Name, first is object, second ID for object.For first function name, client it is to be searched for object, for Two function names, the client ID for object to be searched.
The executor of JavaScript can call the JavaScript function for performing service end, service end JavaScript function will provide element corresponding object type according to the function name, object information and root object ID that receive (class attributes) or the corresponding text of object (Text attributes) search the JavaScript function of object, pass through JavaScript function, generates lookup result, and returns lookup result, i.e., return object to be searched to above-mentioned executor The ID (second function name of correspondence) of (first function name of correspondence) or object.Above-mentioned executor is by object to be searched And/or the ID of object passes to client.
After client receives the ID of object to be searched and/or object, Object Operations unit 404 just can basis Lookup result operates the object, for example, the operation such as can carry out clicking on, move, be input into.
By the object recognition equipment of the present invention, dynamic GUI Object can be solved and recognized less than or recognized inaccurate Problem;Object is searched using the form identification for performing JavaScript function, it is in hgher efficiency.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can adopt complete hardware embodiment, complete software embodiment or with reference to the reality in terms of software and hardware Apply the form of example.And, the present invention can be using the computer for wherein including computer usable program code at one or more The computer program implemented in usable storage medium (including but not limited to disk memory, CD-ROM, optical memory etc.) is produced The form of product.
The present invention be with reference to method according to embodiments of the present invention, equipment (system), and computer program flow process Figure and/or block diagram are describing.It should be understood that can be by computer program instructions flowchart and/or each stream in block diagram The combination of journey and/or square frame and flow chart and/or flow process and/or square frame in block diagram.These computer programs can be provided The processor of general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced for reality by the instruction of computer or the computing device of other programmable data processing devices The device of the function of specifying in present one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in and can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory is produced to be included referring to Make the manufacture of device, the command device realize in one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or The function of specifying in multiple square frames.
These computer program instructions can be also loaded in computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented process, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow process of flow chart or multiple flow processs and/or block diagram one The step of function of specifying in individual square frame or multiple square frames.
Apply specific embodiment to be set forth the principle and embodiment of the present invention in the present invention, above example Explanation be only intended to help and understand the method for the present invention and its core concept;Simultaneously for one of ordinary skill in the art, According to the thought of the present invention, will change in specific embodiments and applications, in sum, in this specification Appearance should not be construed as limiting the invention.

Claims (6)

1. a kind of object identifying method based on dynamic graphical user interface, it is characterised in that described object identifying method bag Include:
The executor of the JavaScript in Selenium is called to obtain root object ID from service end;
Function name, object information and described root object ID are sent to into described service end by described executor;
The lookup result of the object is obtained by described executor from described service end, described lookup result passes through institute The executor for stating calls described service end JavaScript function, is believed according to the function name, object by described service end Breath and root object ID are generated;
The object is operated according to described lookup result.
2. object identifying method according to claim 1, it is characterised in that described object information be object type or The corresponding text of object.
3. object identifying method according to claim 1, it is characterised in that described lookup result includes:To be searched The ID of object or object.
4. a kind of object recognition equipment based on dynamic graphical user interface, it is characterised in that described object recognition equipment bag Include:
Root object acquiring unit, for calling the executor of the JavaScript in Selenium to obtain root object from service end ID;
Information transmitting unit, for function name, object information and described root object ID are sent to by described executor Described service end;
Lookup result acquiring unit, for obtaining the lookup knot of the object by described executor from described service end Really, described lookup result calls described service end JavaScript function by described service end by described executor Generated according to the function name, object information and root object ID;
Object Operations unit, for operating the object according to described lookup result.
5. object recognition equipment according to claim 4, it is characterised in that described object information be object type or The corresponding text of object.
6. object recognition equipment according to claim 4, it is characterised in that described lookup result includes:To be searched The ID of object or object.
CN201410542900.9A 2014-10-14 2014-10-14 Object identifying method based on dynamic graphical user interface Active CN104317705B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410542900.9A CN104317705B (en) 2014-10-14 2014-10-14 Object identifying method based on dynamic graphical user interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410542900.9A CN104317705B (en) 2014-10-14 2014-10-14 Object identifying method based on dynamic graphical user interface

Publications (2)

Publication Number Publication Date
CN104317705A CN104317705A (en) 2015-01-28
CN104317705B true CN104317705B (en) 2017-04-05

Family

ID=52372940

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410542900.9A Active CN104317705B (en) 2014-10-14 2014-10-14 Object identifying method based on dynamic graphical user interface

Country Status (1)

Country Link
CN (1) CN104317705B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655817A (en) * 2009-09-24 2010-02-24 成都市华为赛门铁克科技有限公司 Method and apparatus for testing graphical user interface
CN104008042A (en) * 2013-02-21 2014-08-27 阿里巴巴集团控股有限公司 UI (user interface) automated testing method, system and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9075914B2 (en) * 2011-09-29 2015-07-07 Sauce Labs, Inc. Analytics driven development
US9195572B2 (en) * 2011-12-16 2015-11-24 Sap Se Systems and methods for identifying user interface (UI) elements

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655817A (en) * 2009-09-24 2010-02-24 成都市华为赛门铁克科技有限公司 Method and apparatus for testing graphical user interface
CN104008042A (en) * 2013-02-21 2014-08-27 阿里巴巴集团控股有限公司 UI (user interface) automated testing method, system and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Selenium自动化测试用例设计注意事项(一);sy5980;《中国测试平台》;20130226;第1-4页 *

Also Published As

Publication number Publication date
CN104317705A (en) 2015-01-28

Similar Documents

Publication Publication Date Title
CN104267947B (en) A kind of editor's method of pop-up picture and pop-up picture editor's device
US9720811B2 (en) Unified model for visual component testing
CN107423048B (en) Data collection method, device, medium and computing equipment
CN107133174A (en) Test case code automatically generating device and method
US10216727B2 (en) Visually differentiating strings for testing
CN106250104B (en) A kind of remote operating system for server, method and device
CN104899016B (en) Allocating stack Relation acquisition method and device
US8954928B2 (en) Version labeling in a version control system
CN108228288A (en) A kind of component system and its call method and device
US10175954B2 (en) Method of processing big data, including arranging icons in a workflow GUI by a user, checking process availability and syntax, converting the workflow into execution code, monitoring the workflow, and displaying associated information
US10303751B1 (en) System and method for interaction coverage
US20140129620A1 (en) Indicating coverage of web application testing
CN106354519A (en) Method and device for generating label for user portrait
CN106557426B (en) A kind of method and system for analyzing the ends Android application operation fluency
CN104820634A (en) Method and device for detecting page test track
US20160057180A1 (en) Social Collaborative Mapping
CN109683773A (en) Corpus labeling method and device
CN110018866B (en) User interface theme updating method, device and system, vehicle machine and vehicle
CN111427760A (en) Page testing method, device, equipment and storage medium
CN105117404B (en) Based on the chart display defect optimization method under subtype and data feature scene
CN104598133B (en) The specification generation method and device of object
CN107766307A (en) A kind of method and apparatus of Form Element linkage
US10282216B2 (en) Automatic import of third party analytics
CN105653441A (en) Method and system for UI traversal testing
CN106991110A (en) The switching method and device of Webpage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant