CN104317705A - Dynamic graphic user interface-based object identification method - Google Patents

Dynamic graphic user interface-based object identification method Download PDF

Info

Publication number
CN104317705A
CN104317705A CN201410542900.9A CN201410542900A CN104317705A CN 104317705 A CN104317705 A CN 104317705A CN 201410542900 A CN201410542900 A CN 201410542900A CN 104317705 A CN104317705 A CN 104317705A
Authority
CN
China
Prior art keywords
service end
lookup result
actuator
root
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.)
Granted
Application number
CN201410542900.9A
Other languages
Chinese (zh)
Other versions
CN104317705B (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

Abstract

The invention provides a dynamic graphic user interface (GUI)-based object identification method and device. The object identification method comprises the steps of calling an executor of a JavaScript in a Selenium to obtain a root object ID (identity) from a server side; sending a function name, object information and the root object ID to the server side by the executor; obtaining the search result of the object from the server side by the executor, wherein the search result is generated by the server side according to the function name, the object information and the root object ID; operating the object according to the search result. Through the dynamic graphic user interface-based object identification method and device, the problem of incapability or inaccuracy of identification on a dynamical GUI object is solved, the object is identified and searched by using a JavaScript function executing mode and the efficiency is higher.

Description

Based on the object identifying method of dynamic graphical user interface
Technical field
The invention relates to graphic user interface automatization testing technique, particularly about a kind of object identifying method based on dynamic graphical user interface.
Background technology
The most crucial work of UI automatic test recognizes the interface element (object) wanting to operate, such as a text box (Textbox) or a button (Button), first must to obtain these objects, can operate.For static GUI (Graphical User Interface graphic user interface), current existing automated test frame (instrument) is by first recording script, then the unique identification (ID) when playback according to interface element (object) effectively can recognize this element (object), but for dynamic GUI, because unique identification (ID) dynamically changes, go to identify that just there will be two kinds of situations when playback according to the unique identification (ID) when recording: (1) identifies that the object recognized less than element (object) (2) is not the element (object) wanting to operate.
In order to solve the problem, the web application test macro of increasing income (Selenium automated test frame (instrument)) of the complete set of ThoughtWorks company exploitation.The object identifying method had comprises according to By.id (ID of interface element), By.className (ClassName of interface element), By.tagName (tagName of interface element) etc., but it has following shortcoming:
Except By.id (ID of interface element), all can not identify a unique interface object, need to distinguish according to other object properties the object wanting to recognize again in numerous identification object, recognition efficiency reduces greatly;
By.id (ID of interface element) can effectively identify for static GUI and also efficiency very high, but dynamic GUI is then identified less than or identifies inaccurate.
If page control is in frame or Iframe, needs to be introduced in frame or Iframe and then search; If frame or iframe is many on interface, need to jump into frequently and jump out.
In order to solve problems of the prior art, a kind of automatic testing instrument (QTP) of Mercury company exploitation, its General Requirements 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 according to the object name in script, can find corresponding Warehouse object in object store.But it has following shortcoming: the value of the characteristic attribute of practical object is also that ID or name of object is equivalent, can effectively identify for static GUI and also efficiency very high, but dynamic GUI is then identified less than or identifies inaccurate.
Summary of the invention
The invention provides a kind of object identifying method based on dynamic graphical user interface and device, with to solve in prior art dynamic GUI object identification less than or identify inaccurate problem.
To achieve these goals, the invention provides a kind of object identifying method based on dynamic graphical user interface, described object identifying method comprises:
The actuator calling the JavaScript in Selenium obtains root object ID from service end;
Function name, object information and described root object ID are sent to described service end by described actuator;
Obtained the lookup result of described object from described service end by described actuator, described lookup result is generated according to described function name, object information and root object ID by described service end;
Described object is operated according to described lookup result.
In one embodiment, described object information is the text that object type or object are corresponding.
In one embodiment, described lookup result comprises: the object that search or the ID of object.
In one embodiment, described object identifying method also comprises: call the lookup result described in described service end JavaScript function generation by described actuator, and return described lookup result.
To achieve these goals, the present invention also provides a kind of object recognition equipment based on dynamic graphical user interface, and described object recognition equipment comprises:
Root object acquiring unit, obtains root object ID for the actuator calling the JavaScript in Selenium from service end;
Information transmitting unit, for sending to described service end by function name, object information and described root object ID by described actuator;
Lookup result acquiring unit, for being obtained the lookup result of described object from described service end by described actuator, described lookup result is generated according to described function name, object information and root object ID by described service end;
Object Operations unit, for operating described object according to described lookup result.
In one embodiment, described object information is the text that object type or object are corresponding.
In one embodiment, described lookup result comprises: the object that search or the ID of object.
In one embodiment, described object recognition equipment also comprises: function calling cell, for being called the lookup result described in described service end JavaScript function generation by described actuator, and returns described lookup result.
By the present invention, can solve dynamic GUI object identification less than or identify inaccurate problem; Utilize the form identification performing JavaScript function to search object, efficiency is higher.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the object identifying method process flow diagram of the embodiment of the present invention;
Fig. 2 is the process flow diagram that in the embodiment of the present invention, client obtains root object ID;
Fig. 3 obtains the process flow diagram of the ID of object and/or the object that will search for client in the embodiment of the present invention;
Fig. 4 is the structured flowchart of the object recognition equipment of the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
As shown in Figure 1, embodiments provide a kind of object identifying method based on dynamic graphical user interface, this object identifying method comprises:
S101: the actuator calling the JavaScript in Selenium obtains root object ID from service end;
S102: function name, object information and described root object ID are sent to described service end by described actuator;
S103: the lookup result being obtained described object by described actuator from described service end, described lookup result is generated according to described function name, object information and root object ID by described service end;
S104: operate described object 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 can also be IE, and such as user carries out web page access by IE and is, IE is client, and webpage is service end.
From the flow process of Fig. 1, client carries out twice information interaction by the actuator of the JavaScript in Selenium and service end, first time is that client obtains root object ID from service end, second time sends function name, object information and root object ID for client to service end, obtains the ID of object or the object that will search.By twice information interaction, can solve dynamic GUI object identification less than or identify inaccurate problem; Utilize the form identification performing JavaScript function to search object, efficiency is higher.
Above-mentioned actuator can be provided by Selenium, as Object executeScript (String script, Object...args).
When S101 specifically implements, as shown in Figure 2, the actuator that client can call the JavaScript in Selenium sends root object ID acquisition solicited message to service end, to obtain the root object ID of whole GUI, namely obtain corresponding Body label (can obtain according to the By.tagName of Selenium (" body ")).Service end sends root object ID by above-mentioned actuator to client after receiving this root object ID acquisition solicited message.Client can obtain root object ID eventually through the actuator of the JavaScript in Selenium from service end.
After client obtains root object ID, will S102 and S103 be carried out, function name, object information and root object ID will be sent to service end by above-mentioned actuator.In one embodiment, this object information is the text that object type or object are corresponding.Object type is class attribute, and the text that object is corresponding is Text attribute.During concrete enforcement, as shown in Figure 3, client sends function name, object information and root object ID to above-mentioned actuator, after actuator receives function name, object information and root object ID, function name, object information and root object ID is sent to service end.
Client can comprise the function name of multiple function to the function name that service end sends, such as, comprise two function names, and first is object, and second is the ID of object.For first function name, what client will be searched is object, for second function name, and the ID for object that client will be searched.
The actuator of JavaScript can call the JavaScript function performing service end, the JavaScript function of service end is by according to the function name received, the JavaScript function of object searched by the object type (class attribute) that object information and root object ID provide element corresponding or text (Text attribute) corresponding to object, pass through JavaScript function, generate lookup result, and return lookup result, namely the ID (corresponding second function name) of object (corresponding first function name) or the object that will search is returned to above-mentioned actuator.The ID of the object that will search and/or object is passed to client by above-mentioned actuator.
After client receives the ID of object and/or the object that will search, just can operate this object according to described lookup result, such as, can carry out clicking, move, the operation such as input.
By object identifying method of the present invention, can solve dynamic GUI object identification less than or identify inaccurate problem; Utilize the form identification performing JavaScript function to search object, efficiency is higher.
As shown in Figure 4, the invention provides a kind of object recognition equipment based on dynamic graphical user interface, its this object recognition equipment comprises: root object acquiring unit 401, information transmitting unit 402, lookup result acquiring unit 403 and Object Operations unit 404.
Root object acquiring unit 401 obtains root object ID for the actuator calling the JavaScript in Selenium from service end.When S101 specifically implements, the actuator that root object acquiring unit 401 can call the JavaScript in Selenium sends root object ID acquisition solicited message to service end, to obtain the root object ID of whole GUI, namely obtain corresponding Body label (can obtain according to the By.tagName of Selenium (" body ")).Service end sends root object ID by above-mentioned actuator to client after receiving this root object ID acquisition solicited message.Client can obtain root object ID eventually through the actuator of the JavaScript in Selenium from service end.
Information transmitting unit 402 is for sending to described service end by function name, object information and described root object ID by described actuator.Lookup result acquiring unit 403 is for obtaining the lookup result of described object from described service end by described actuator, described lookup result is generated according to described function name, object information and root object ID by described service end.After client obtains root object ID, function name, object information and root object ID are sent to service end by above-mentioned actuator.In one embodiment, this object information is the text that object type or object are corresponding.Object type is class attribute, and the text that object is corresponding is Text attribute.During concrete enforcement, client sends function name, object information and root object ID to above-mentioned actuator, after actuator receives function name, object information and root object ID, function name, object information and root object ID is sent to service end.
Client can comprise the function name of multiple function to the function name that service end sends, such as, comprise two function names, and first is object, and second is the ID of object.For first function name, what client will be searched is object, for second function name, and the ID for object that client will be searched.
The actuator of JavaScript can call the JavaScript function performing service end, the JavaScript function of service end is by according to the function name received, the JavaScript function of object searched by the object type (class attribute) that object information and root object ID provide element corresponding or text (Text attribute) corresponding to object, pass through JavaScript function, generate lookup result, and return lookup result, namely the ID (corresponding second function name) of object (corresponding first function name) or the object that will search is returned to above-mentioned actuator.The ID of the object that will search and/or object is passed to client by above-mentioned actuator.
After client receives the ID of object and/or the object that will search, Object Operations unit 404 just can operate this object according to lookup result, such as, can carry out clicking, move, the operation such as input.
By object recognition equipment of the present invention, can solve dynamic GUI object identification less than or identify inaccurate problem; Utilize the form identification performing JavaScript function to search object, efficiency is higher.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Apply specific embodiment in the present invention to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (8)

1. based on an object identifying method for dynamic graphical user interface, it is characterized in that, described object identifying method comprises:
The actuator calling the JavaScript in Selenium obtains root object ID from service end;
Function name, object information and described root object ID are sent to described service end by described actuator;
Obtained the lookup result of described object from described service end by described actuator, described lookup result is generated according to described function name, object information and root object ID by described service end;
Described object is operated according to described lookup result.
2. object identifying method according to claim 1, is characterized in that, described object information is the text that object type or object are corresponding.
3. object identifying method according to claim 1, is characterized in that, described lookup result comprises: the object that search or the ID of object.
4. object identifying method according to claim 1, is characterized in that, described object identifying method also comprises: call the lookup result described in described service end JavaScript function generation by described actuator, and return described lookup result.
5. based on an object recognition equipment for dynamic graphical user interface, it is characterized in that, described object recognition equipment comprises:
Root object acquiring unit, obtains root object ID for the actuator calling the JavaScript in Selenium from service end;
Information transmitting unit, for sending to described service end by function name, object information and described root object ID by described actuator;
Lookup result acquiring unit, for being obtained the lookup result of described object from described service end by described actuator, described lookup result is generated according to described function name, object information and root object ID by described service end;
Object Operations unit, for operating described object according to described lookup result.
6. object recognition equipment according to claim 5, is characterized in that, described object information is the text that object type or object are corresponding.
7. object recognition equipment according to claim 5, is characterized in that, described lookup result comprises: the object that search or the ID of object.
8. object recognition equipment according to claim 5, is characterized in that, described object recognition equipment also comprises:
Function calling cell, for being called the lookup result described in described service end JavaScript function generation by described actuator, and returns described lookup result.
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 true CN104317705A (en) 2015-01-28
CN104317705B 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 (4)

* 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
WO2013049853A1 (en) * 2011-09-29 2013-04-04 Sauce Labs, Inc. Analytics driven development
US20130159890A1 (en) * 2011-12-16 2013-06-20 Sap Ag Systems and methods for identifying user interface (ui) elements
CN104008042A (en) * 2013-02-21 2014-08-27 阿里巴巴集团控股有限公司 UI (user interface) automated testing method, system and device

Patent Citations (4)

* 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
WO2013049853A1 (en) * 2011-09-29 2013-04-04 Sauce Labs, Inc. Analytics driven development
US20130159890A1 (en) * 2011-12-16 2013-06-20 Sap Ag Systems and methods for identifying user interface (ui) elements
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
SY5980: "Selenium自动化测试用例设计注意事项(一)", 《中国测试平台》 *

Also Published As

Publication number Publication date
CN104317705B (en) 2017-04-05

Similar Documents

Publication Publication Date Title
US20170139720A1 (en) Digital assistant setting up device
US9075918B1 (en) System and method for creating change-resilient scripts
CN107644286B (en) Workflow processing method and device
US10235280B2 (en) Automated script creation and source code generation for testing mobile devices
CN106874174B (en) Method and device for realizing interface test and function test
KR20170003578A (en) Code service for language-independent dispatch
CN104182335A (en) Software testing method and device
CN110750437B (en) Equipment debugging method, device, equipment and system
US10193989B2 (en) Visualization of user behavior
CN103984626A (en) Method and device for generating test-case script
CN104423961A (en) Method and system for generating testing script
CN106201562A (en) A kind of page switching method and device
US20220138074A1 (en) Method, electronic device and computer program product for processing data
CN104572431A (en) Test method and test device
CN110096413A (en) A kind of disk localization method, system and electronic equipment and storage medium
CN109947624A (en) Method for monitoring state and device
US10282216B2 (en) Automatic import of third party analytics
CN106843857B (en) Method and device for realizing SDK (software development kit) conversion of code base based on SRP (sequence-related protocol)
CN107846344B (en) Method and device for pushing messages in batch in instant messaging tool and electronic equipment
CN105279076A (en) Webpage test method and terminal
CN104317705A (en) Dynamic graphic user interface-based object identification method
CN114880020A (en) Software development kit management method, related device and computer program product
CN105335341A (en) Method and device for remotely processing Excel file through webpage
US10229095B2 (en) Expanded icon navigation
CN106598974B (en) Data file generation and calling method and device for android system application program

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