CN109933528A - A kind of method and device of automatized script encapsulation - Google Patents

A kind of method and device of automatized script encapsulation Download PDF

Info

Publication number
CN109933528A
CN109933528A CN201910180415.4A CN201910180415A CN109933528A CN 109933528 A CN109933528 A CN 109933528A CN 201910180415 A CN201910180415 A CN 201910180415A CN 109933528 A CN109933528 A CN 109933528A
Authority
CN
China
Prior art keywords
mode
term
interface
caching
property
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910180415.4A
Other languages
Chinese (zh)
Inventor
雷伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
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 Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN201910180415.4A priority Critical patent/CN109933528A/en
Publication of CN109933528A publication Critical patent/CN109933528A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the present application provides a kind of method of automatized script encapsulation, which comprises obtains element property of the element on interface;The element term and element type of the element are obtained and cached according to the element property;The element term is visual title of the element at the interface;It obtains and caches mode of operation corresponding with the element type;Automatically it obtains and the matched element term of default test data and is operated according to the mode of operation from the element term of caching.Using method provided by the present application, it can be effectively reduced the size of code and writing difficulty of script, promote the maintainability of automatized script, to reduce the cost that UI automation needs to put into.The embodiment of the present application also provides device, a kind of electronic equipment and a kind of storage mediums of a kind of encapsulation of automatized script.

Description

A kind of method and device of automatized script encapsulation
Technical field
This application involves the method and devices that field of computer technology more particularly to a kind of automatized script encapsulate.
Background technique
UI (User Interface, user interface) refers to that user and certain systems interact the set of method, these System not merely refers to computer program, further includes certain machines with specific function, equipment, tool of complexity etc..
The method that existing UI automation is realized, usually by writing executable automatized script to realize with simulation behaviour Make replacement interface manual operations, most of automatized script by way of object-oriented to different element types one by one It is identified and is write, and element operation is packaged one by one, such write method will cause when interface element is excessive More, complicated, maintainability difference the problems of automatized script code, such as may refer to form interface schematic diagram shown in FIG. 1, list In include selection control, menu control, input control, numerous elements such as date control, it is more in the element of form interface In the case of, element type is identified and is write one by one and one by one to element carry out operation will lead to the content of script accordingly compared with It is more, compiling procedure is complex, and often repeat in script with the code of identical function (such as identification function), Code redundancy is further resulted in, in addition, the maintainability of this method is very low, weight is generally required when interface information is had some change Script is newly write, these problems all improve UI indirectly and automate the cost that need to be put into, and the automation of UI is caused to be not appropriate for greatly The popularization of batch.
Summary of the invention
In order to solve above-mentioned technical problem of the existing technology, this application provides a kind of sides of automatized script encapsulation Method and device can be effectively reduced the size of code and writing difficulty of script, promote the maintainability of automatized script, to reduce The cost that UI automation needs to put into.
This application provides a kind of methods of automatized script encapsulation, which comprises
Obtain element property of the element on interface;
The element term and element type of the element are obtained and cached according to the element property;The element term is Visual title of the element at the interface;
It obtains and caches mode of operation corresponding with the element type;
Automatically it obtains from the element term of caching with the matched element term of default test data and according to described Mode of operation is operated.
Optionally, the element property for obtaining element on interface includes:
According to the default interface property at the interface, all available members that the default interface property includes are obtained automatically Element.
Optionally, the element term for being obtained according to the element property and caching the element and element type packet It includes:
The element term and element type that the element is shown on the interface are obtained according to the element property, is cached The element term and the corresponding relationship for caching the element term and element type.
Optionally, the test data is stored in the form of key-value pair Key-value, and the index value Key of the key-value pair is The element term.
Optionally, described to be obtained and the matched element term of default test data from the element term of caching automatically And operation is carried out according to the mode of operation and includes:
Automatically test elements title is obtained from caching;In the element term of the entitled caching of test elements with institute State the matched element term of index value Key of default test data;
The corresponding mode of operation of the test elements title is obtained from caching and executes corresponding operating.
Optionally, the element property includes at least following one such:
Extensible markup language path language XPath, identification number ID, class Class, element name name, bookmark name TagName, hypertext link text information link_text, part hypertext link text information partial_link_text and Cascading style sheets CSS.
Optionally, the element type includes at least following one such:
Input frame, choice box, button, date choice box, menu, picture box, color selection box, hyperlink label and column Table.
Optionally, it the acquisition and caches mode of operation corresponding with the element type and includes:
If the element type is input frame, obtains and cache the mode of operation as input frame input;
If the element type is choice box, obtaining and caching the mode of operation is that single choice or final election operate;
If the element type is button, obtains and cache the mode of operation to click button;
If the element type is date choice box, obtains and cache the mode of operation as date selection;
If the element type is menu, obtaining and caching the mode of operation is that menu is shown;
If the element type is picture box, obtaining and caching the mode of operation is that picture is shown;
If the element type is color selection box, obtains and cache the mode of operation as color selection;
If the element type is hyperlink label, obtaining and caching the mode of operation is page jump;
If the element type is list, obtaining and caching the mode of operation is that choosing is looked into list.
The embodiment of the present application also provides a kind of devices of automatized script encapsulation, and described device includes: the first acquisition list Member, second acquisition unit, third acquiring unit and operating unit;
The first acquisition unit, for obtaining element property of the element on interface;
The second acquisition unit, for the element term and member of the element to be obtained and cached according to the element property Plain type;The element term is visual title of the element at the interface;
The third acquiring unit, for obtaining and caching mode of operation corresponding with the element type;
The operating unit, for being obtained and the matched member of default test data from the element term of caching automatically Plain title is simultaneously operated according to the mode of operation.
Optionally, the first acquisition unit is specifically used for the default interface property according to the interface, obtains institute automatically State all available elements that default interface property includes.
Optionally, the second acquisition unit includes: the first acquisition subelement and caching subelement;
Described first obtains subelement, for obtaining what the element was shown on the interface according to the element property Element term and element type;
The caching subelement, for caching the element term and to cache the element term corresponding with element type Relationship.
Optionally, the test data is stored in the form of key-value pair Key-value, and the index value Key of the key-value pair is The element term.
Optionally, the operating unit includes: the second acquisition subelement and execution subelement;
Described second obtains subelement, for obtaining test elements title from caching automatically;The test elements are entitled The matched element term of index value Key in the element term of caching with the default test data;
The execution subelement, for obtaining the corresponding mode of operation of the test elements title from caching and executing phase It should operate.
Optionally, the element property includes at least following one such:
Extensible markup language path language XPath, identification number ID, class Class, element name name, bookmark name TagName, hypertext link text information link_text, part hypertext link text information partial_link_text and Cascading style sheets CSS.
Optionally, the element type includes at least following one such:
Input frame, choice box, button, date choice box, menu, picture box, color selection box, hyperlink label and column Table.
Optionally, the third acquiring unit is specifically used for:
If the element type is input frame, obtains and cache the mode of operation as input frame input;
If the element type is choice box, obtaining and caching the mode of operation is that single choice or final election operate;
If the element type is button, obtains and cache the mode of operation to click button;
If the element type is date choice box, obtains and cache the mode of operation as date selection;
If the element type is menu, obtaining and caching the mode of operation is that menu is shown;
If the element type is picture box, obtaining and caching the mode of operation is that picture is shown;
If the element type is color selection box, obtains and cache the mode of operation as color selection;
If the element type is hyperlink label, obtaining and caching the mode of operation is page jump;
If the element type is list, obtaining and caching the mode of operation is that choosing is looked into list.
The embodiment of the present application also provides a kind of electronic equipment, the electronic equipment is for running program, wherein the journey The method of automatized script encapsulation described in any of the above embodiments is executed when sort run.
The embodiment of the present application also provides a kind of storage mediums, are stored thereon with program, and described program is held by electronic equipment The method of automatized script encapsulation described in any of the above embodiments is realized when row.
Herein described method has the advantage that
This application provides a kind of methods of automatized script encapsulation, which comprises obtains element on interface Element property;It is obtained according to the element property and caches element term and element class that the element is shown on the interface Type, the element term are visual title of the element at the interface, and the element term can be used for and preset test Data convention binding identification, the element type are used to analyze the mode of operation of the element;It obtains and caches and the element The corresponding mode of operation of type;Automatically it is obtained and the matched element term of default test data from the element term of caching And it is operated according to the mode of operation, such as the operation such as input frame input, choice box drop-down selection.
Method provided by the present application is answered by original recognition element one by one, one by one by what the mode of operation of element was packaged Miscellaneous process is encapsulated as a method, and the default test data that can be passed to according to user carries out identification and the operation side of element automatically The implementation of formula can be effectively reduced the size of code and writing difficulty of script, promote the maintainability of automatized script, reduce UI Automation needs the cost put into.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The some embodiments recorded in application, for those of ordinary skill in the art, without creative efforts, It can also be obtained according to these attached drawings other attached drawings.
Fig. 1 is the schematic diagram of form interface provided by the present application;
Fig. 2 is a kind of flow chart of the method for automatized script encapsulation that the embodiment of the present application one provides;
Fig. 3 is a kind of schematic diagram of the device for automatized script encapsulation that the embodiment of the present application two provides.
Specific embodiment
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only this Apply for a part of the embodiment, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art exist Every other embodiment obtained under the premise of creative work is not made, shall fall in the protection scope of this application.
Embodiment one:
The embodiment of the present application one provides a kind of method of automatized script encapsulation, illustrates with reference to the accompanying drawing.
Referring to fig. 2, which is a kind of flow chart of the method for automatized script encapsulation that the embodiment of the present application one provides.
The embodiment of the present application the described method comprises the following steps:
S201: element property of the element on interface is obtained.
The interface refers to the operation interface of user, includes to move APP, webpage, interface shown by intelligent wearable device etc., By being operated on the interface, the interactive process of people and equipment and software may be implemented.
The element is the various controls on the interface, such as selection control, menu control, input control, date control Part, picture control and list control etc..
Visual entitled element term of the element on the interface, the element in form interface shown in Fig. 1 Title has " selection client region, " " selection money tubing type ", " selection customer type ", " sales department ", " customer number ", " client Name ", " client is referred to as " etc., since element term can freely be set, element term can be corresponding with element all kinds of The title of control is unrelated.
The element property be the element in written in code in order to distinguish element and additional code information, usual institute State that element property is invisible on interface, by the element property can by element on the interface according to different foundations into Row classification, is easy to implement the rapid inquiry to element in the huge number of the element, the element property include at least with Under it is one such:
XPath (Extensible Markup Language Path Language, extensible markup language path language Speech), identification number ID, class Class, element name name, bookmark name tagName, hypertext link text information link_ Text, part hypertext link text information partial_link_text and CSS (Cascading Style Sheets, stacking Style sheet) etc..
Wherein the XPath is a kind of language for determining certain portion in XML document, and XPath can be based on XML Tree, the ability that node is looked in data-structure tree is provided.
The identification number ID is the mark for element or a certain dvielement, and the identification number can be digital volume Code, alpha code, English abbreviation or other from coding is set, can also be the combination of a variety of codings, the application does not make this specifically It limits.
The class Class includes that data are illustrated, operation operation is carried out or transmits the function of message, and the class is Definition to certain element, the method for describing the effect an of element and realizing the effect, class may include coherent element The information such as the event that occurs of mode of operation, element term, the connection between each element and element.
The element name refers to the name when writing the scripted code of the element, with member of the element on the interface Plain title can be the same or different.
The bookmark name tagName is used to return the tag name of element.
The hypertext link text information link_text is used to carry out the positioning of element, example according to the text of link The positioning of " certificate validity period " Lai Jinhang corresponding element in form interface shown in FIG. 1 can such as be passed through.
The part hypertext link text information partial_link_text is also used for the positioning of element, usage and super Text link text information link_text is similar, is distinguished as can choose a part of field in the link text of this element and comes It realizes positioning, such as can choose the positioning of " validity period " Lai Jinhang corresponding element in " certificate validity period ".
The CSS is a kind of computer language for showing the files pattern such as HTML or XML, and CSS not only can be static Ground modified web page can also cooperate various scripting languages to be dynamically formatted to webpage each element, can be to first in webpage The typesetting of plain position carries out Pixel-level and accurately controls, and has the ability to web object and model pattern editor.
Further, can be according to the default interface property at the interface, obtaining the default interface property automatically includes All available elements.
The default interface property, and it is properly termed as the parent attribute at the interface, it is the classification to the element, such as Default interface property in form interface shown in FIG. 1 includes " client region ", " money tubing type ", " client's classification ", " client compiles Number ", " client's fundamental type " etc. by identifying the default interface property can quickly determine the range of element, acquisition has The element term and/or element type of the default interface property.Such as when determining that the default interface property is " customer class When not ", the element term for all available elements that the default interface property obtained automatically includes is " sales department " and " client Number ", then for example when determining the default interface property is " client's essential information ", the default interface obtained automatically belongs to Property include all available elements element term be " customer name ", " client referred to as ", cellular phone, " certificate classification ", " passport NO. ", " certificate validity period ", " client gender ", " date of birth " and " Investor Type ".
It should be noted that the default interface property can have different levels, the number for the available element that level includes Amount increases as level improves, and the reality that the default interface property only has one layer is only gived in form interface shown in FIG. 1 Example, when the default interface property level number be greater than for the moment, the default interface property can successively be identified, also The default interface property that the tested interface bottom level can be predefined directly acquires bottom and presets the institute that interface property includes There is available element, the application is not especially limited this.
S202: obtaining according to the element property and caches the element term and element type of the element;The element Visual title of the entitled element at the interface.
The element term is visual title of the element at the interface, and the element term is in subsequent step Binding identification is carried out with default test data, i.e., can store the test number of certain element terms in the default test data According in test from the element term for being obtained in the element term that the interface includes with including in the default test data The element term matched.
The element type, that is, corresponding the type of element control, if the corresponding element type of input control is input Frame, to select the corresponding element type of control be choice box, the corresponding element type of button control is that button, date control are corresponding Element type is date choice box etc., and the element type includes at least following one such:
Input frame, choice box, button, date choice box, menu, picture box, color selection box, hyperlink label and column Table.
Referring to form interface shown in FIG. 1 for example:
The input frame is used to carry out the input of data information, such as the input of " customer name " and " client is referred to as ";Institute Choice box is stated for recalling drop-down menu to carry out data selection, such as " certificate classification ", " client gender " and " investor's class The input of type " etc.;The date choice box, for carrying out the selection on date, such as to " certificate validity period " and " date of birth " Selection.
Further, the step further include: the element is obtained according to the element property and is shown on the interface Element term and element type, cache the element term and cache the corresponding relationship of the element term and element type.
In order to include from acquisition in the element term that the interface includes and the default test data in test The matched element term of element term needs to cache the element term, in addition, obtaining the described and default test number It also needs to obtain its corresponding element type after the matched element term of the element term for including in, therefore also needs the member The corresponding relationship of plain title and element type caching.
S203: obtaining and caches mode of operation corresponding with the element type.
The mode of operation is processing method of the element type to the data, by according to the element pre-established The corresponding relationship of type and mode of operation obtains the mode of operation of the interface element, specifically:
If the element type is input frame, obtains and cache the mode of operation as input frame input;
If the element type is choice box, obtaining and caching the mode of operation is that single choice or final election operate;
If the element type is button, obtains and cache the mode of operation to click button;
If the element type is date choice box, obtains and cache the mode of operation as date selection;
If the element type is menu, obtaining and caching the mode of operation is that menu shows that the menu can be Right-click menu;
If the element type is picture box, obtaining and caching the mode of operation is that picture is shown;
If the element type is color selection box, obtains and cache the mode of operation as color selection;
If the element type is hyperlink label, obtaining and caching the mode of operation is page jump;
If the element type is list, obtaining and caching the mode of operation is that choosing is looked into list, is carrying out list selection When, the list can be radio list or final election list.
S204: it is obtained from the element term of caching automatically and the matched element term of default test data and basis The mode of operation is operated.
If including the test data to the interface whole element in the default test data, the whole of caching is obtained Element term simultaneously obtains corresponding mode of operation according to the element term.
If including the test data to the interface portion element in the default test data, from the element of caching Element term present in the default test data is obtained in title and corresponding operation side is obtained according to the element term Formula.
Then according to the mode of operation carry out corresponding operation, such as the mode of operation be input frame input when, into Capable operation is input to test data in corresponding input frame.
Further, the test data is stored in the form of key-value pair Key-value, the index value Key of the key-value pair It is " date of birth=2000-1-1 " for the element term, such as test data, wherein " date of birth " is index value, i.e., it is first Plain title, and " 2000-1-1 " is storage value, i.e., the object of the described mode of operation operation;Such as test data is " client's surname again Name=123 ", wherein " customer name " is index value, i.e. element term, and " 123 " are storage value, when respective operations mode is defeated The data automatically entered when entering frame for input frame.Using the form storing data of key-value pair, can effectively storage element title with Corresponding relationship between data value effectively increases the matched efficiency of retrieval.
Further, the step specifically includes:
S204a: test elements title is obtained from caching automatically;The element term of the entitled caching of test elements In the matched masurium of index value Key with the default test data.
S204b: the corresponding mode of operation of the test elements title is obtained from caching and executes corresponding operating.
Form interface shown in Fig. 1 is realized using the embodiment of the present application the method, and the scripted code write is as follows:
Def dealform (InputData, UIExpect=None):
global driver
Jres=JRES1_0 (driver)
jres.doForm(InputData,'name:openClientForm')
The scripted code amount write greatly reduces, and does not also need the identification for carrying out element one by one, but only need to simply adjust With packaging method, and packaging method has versatility for same frame, when interface element is changed without progress Maintenance.
It should be noted that the realization principle of above-mentioned steps herein described method merely for convenience of description, is not Restriction for herein described method can also obtain other implementations by the adjustment to above-mentioned steps, such as In alternatively possible implementation, element property of the element on interface is obtained first;Then it is obtained according to the element property Take and cache the element term that the element is shown on the interface;Again automatically from the element term of caching obtain with The default matched element term of test data;It is last to obtain the member with the matched element term of default test data according to described The type of element and the mode of operation of the element, automatically operate the interface element.
The method of automatized script encapsulation provided by the embodiments of the present application, first element category of the acquisition element on interface Property;Then it is obtained according to the element property and caches element term and element class that the element is shown on the interface Type, the element term are visual title of the element at the interface, and the element term can be used for and preset test Data convention binding identification, the element type are used to analyze the mode of operation of the element;It obtains and caches and the member again The corresponding mode of operation of plain type;Finally obtained and the matched member of default test data from the element term of caching automatically Plain title is simultaneously operated according to the mode of operation, such as the operation such as input frame input, choice box drop-down selection.The application is real The complex process that the method for applying example offer is packaged by original recognition element one by one, one by one by the mode of operation of element encapsulates For a method, the default test data that can be passed to according to user carries out the identification of element and the implementation of mode of operation automatically, A large amount of time cost can be saved, can be effectively reduced the size of code and writing difficulty of script, and the method can be moved State obtains the element at interface, and the Maintenance free automatized script in interface element change further reduced UI automation needs The cost of investment.
Embodiment two:
The method of the automatized script encapsulation provided based on the above embodiment, the embodiment of the present application two additionally provide one kind certainly The device of dynamicization script encapsulation, illustrates with reference to the accompanying drawing.
Referring to Fig. 3, which is a kind of structure chart of the device for automatized script encapsulation that the embodiment of the present application two provides.
The embodiment of the present application described device includes: first acquisition unit 301, second acquisition unit 302, third acquiring unit 303 and operating unit 304.
The first acquisition unit 301, for obtaining element property of the element on interface.
The element property be the element in written in code in order to distinguish element and additional code information, usual institute State that element property is invisible on interface, by the element property can by element on the interface according to different foundations into Row classification, is easy to implement the rapid inquiry to element in the huge number of the element, the element property include at least with Under it is one such:
Extensible markup language path language XPath, identification number ID, class Class, element name name, bookmark name TagName, hypertext link text information link_text, part hypertext link text information partial_link_text and Cascading style sheets CSS.
Further, the first acquisition unit is specifically used for the default interface property according to the interface, automatic to obtain All available elements that the default interface property includes.
The second acquisition unit 302, for the element term of the element to be obtained and cached according to the element property With element type;The element term is visual title of the element at the interface.
Further, the element type includes at least following one such:
Input frame, choice box, button, date choice box, menu, picture box, color selection box, hyperlink label and column Table.
Further, the second acquisition unit 302 includes: the first acquisition subelement 302a and caching subelement 302b.
Described first obtains subelement 302a, aobvious on the interface for obtaining the element according to the element property The element term and element type shown;
The caching subelement 302b, for caching the element term and caching the element term and element type Corresponding relationship.
The third acquiring unit 303, for obtaining and caching mode of operation corresponding with the element type.
Further, the third acquiring unit 303 is specifically used for:
If the element type is input frame, obtains and cache the mode of operation as input frame input;
If the element type is choice box, obtaining and caching the mode of operation is that single choice or final election operate;
If the element type is button, obtains and cache the mode of operation to click button;
If the element type is date choice box, obtains and cache the mode of operation as date selection;
If the element type is menu, obtaining and caching the mode of operation is that menu is shown;
If the element type is picture box, obtaining and caching the mode of operation is that picture is shown;
If the element type is color selection box, obtains and cache the mode of operation as color selection;
If the element type is hyperlink label, obtaining and caching the mode of operation is page jump;
If the element type is list, obtaining and caching the mode of operation is that choosing is looked into list.
The operating unit 304 is matched for obtaining from the element term of caching automatically with default test data Element term and operated according to the mode of operation.
Further, the test data is stored in the form of key-value pair Key-value, the index value Key of the key-value pair For the element term.
Further, the operating unit 304 includes: the second acquisition subelement 304a and execution subelement 304b.
Described second obtains subelement 304a, for obtaining test elements title from caching automatically;The test elements name In the element term referred to as cached with the matched element term of index value Key of the default test data;
The execution subelement 304b, for obtaining the corresponding mode of operation of the test elements title from caching and holding Row corresponding operating.
It should be noted that the words such as " first ", " second " and " third " described in the embodiment of the present application is merely for convenience Terminate explanation, is not the restriction to the embodiment of the present application described device.
The device of automatized script encapsulation provided by the embodiments of the present application obtains element at interface by first acquisition unit On element property;Then it is obtained according to the element property by second acquisition unit and caches the element at the interface The element term and element type of upper display, the element term are visual title of the element at the interface, the member Plain title can be used for and preset test data agreement binding identification, and the element type is used to analyze the operation side of the element Formula;It is obtained again by third acquiring unit and caches mode of operation corresponding with the element type;Finally by operating unit Automatically it obtains from the element term of caching with the matched element term of default test data and according to the mode of operation It is operated, such as the operation such as input frame input, choice box drop-down selection.
Device provided by the embodiments of the present application is sealed by original recognition element one by one, one by one by the mode of operation of element The complex process of dress is encapsulated as a method, the default test data that can be passed to according to user carry out automatically the identification of element with The implementation of mode of operation can save a large amount of time cost, can be effectively reduced the size of code and writing difficulty of script, and The method can be further decreased with the element at dynamic acquisition interface, the Maintenance free automatized script in interface element change The cost that UI automation needs to put into.
The device of the automatized script encapsulation includes processor and memory, and above-mentioned first acquisition unit, second obtain Unit, third acquiring unit and operating unit etc. store in memory as program unit, are stored in by processor execution Above procedure unit in memory realizes corresponding function.
Include kernel in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can be set one Or more, by adjusting kernel parameter come realize automatized script encapsulate.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, if read-only memory (ROM) or flash memory (flash RAM), memory include that at least one is deposited Store up chip.
The embodiment of the present application provides a kind of storage medium, can store program thereon, described program is by electronic equipment The method of the automatized script encapsulation is realized when execution.
Correspondingly, the embodiment of the present application also provides a kind of computer program product, when being executed on data processing equipment When, it is adapted for carrying out the program of initialization there are as below methods step:
Obtain element property of the element on interface;
The element term and element type of the element are obtained and cached according to the element property;The element term is Visual title of the element at the interface;
It obtains and caches mode of operation corresponding with the element type;
Automatically it obtains from the element term of caching with the matched element term of default test data and according to described Mode of operation is operated.
Further, the embodiment of the present application also provides a kind of electronic equipment, electronic equipment include processor, memory and The program that can be run on a memory and on a processor is stored, processor performs the steps of when executing program
Obtain element property of the element on interface;
The element term and element type of the element are obtained and cached according to the element property;The element term is Visual title of the element at the interface;
It obtains and caches mode of operation corresponding with the element type;
Automatically it obtains from the element term of caching with the matched element term of default test data and according to described Mode of operation is operated.
Electronic equipment in the application can be server, PC, PAD, mobile phone etc..
It is understood that described program can be computer program product described above.
It should be appreciated that in this application, " at least one (item) " refers to one or more, and " multiple " refer to two or two More than a."and/or" indicates may exist three kinds of relationships, for example, " A and/or B " for describing the incidence relation of affiliated partner It can indicate: only exist A, only exist B and exist simultaneously tri- kinds of situations of A and B, wherein A, B can be odd number or plural number.Word Symbol "/" typicallys represent the relationship that forward-backward correlation object is a kind of "or"." at least one of following (a) " or its similar expression, refers to Any combination in these, any combination including individual event (a) or complex item (a).At least one of for example, in a, b or c (a) can indicate: a, b, c, " a and b ", " a and c ", " b and c ", or " a and b and c ", and wherein a, b, c can be individually, can also To be multiple.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method Part explanation.The apparatus embodiments described above are merely exemplary, wherein described be used as separate part description Unit and module may or may not be physically separated.Furthermore it is also possible to select it according to the actual needs In some or all of unit and module achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying In the case where creative work, it can understand and implement.
The above is only the specific embodiment of the application, it is noted that for the ordinary skill people of the art For member, under the premise of not departing from the application principle, several improvements and modifications can also be made, these improvements and modifications are also answered It is considered as the protection scope of the application.

Claims (10)

1. a kind of method of automatized script encapsulation, which is characterized in that the described method includes:
Obtain element property of the element on interface;
The element term and element type of the element are obtained and cached according to the element property;The element term is described Visual title of the element at the interface;
It obtains and caches mode of operation corresponding with the element type;
Automatically it obtains from the element term of caching with the matched element term of default test data and according to the operation Mode is operated.
2. the method for automatized script encapsulation according to claim 1, which is characterized in that the acquisition element is on interface Element property include:
According to the default interface property at the interface, all available elements that the default interface property includes are obtained automatically.
3. the method for automatized script encapsulation according to claim 1, which is characterized in that described according to the element property It obtains and caches the element term of the element and element type includes:
The element term and element type that the element is shown on the interface are obtained according to the element property, described in caching Element term and the corresponding relationship for caching the element term and element type.
4. the method for automatized script encapsulation according to claim 1, which is characterized in that the test data is with key-value pair The storage of Key-value form, the index value Key of the key-value pair are the element term.
5. the method for automatized script encapsulation according to claim 4, which is characterized in that described automatically from described in caching In element term obtain with the matched element term of default test data and according to the mode of operation carry out operate include:
Automatically test elements title is obtained from caching;In the element term of the entitled caching of test elements with it is described pre- If the matched element term of the index value of test data;
The corresponding mode of operation of the test elements title is obtained from caching and executes corresponding operating.
6. the method for automatized script encapsulation according to claim 1, which is characterized in that the element property includes at least It is one such below:
Extensible markup language path language XPath, identification number ID, class Class, element name name, bookmark name TagName, hypertext link text information link_text, part hypertext link text information partial_link_text and Cascading style sheets CSS.
7. the method for automatized script encapsulation according to claim 1, which is characterized in that the element type includes at least It is one such below:
Input frame, choice box, button, date choice box, menu, picture box, color selection box, hyperlink label and list.
8. the method for automatized script according to claim 7 encapsulation, which is characterized in that the acquisition and cache with it is described The corresponding mode of operation of element type includes:
If the element type is input frame, obtains and cache the mode of operation as input frame input;
If the element type is choice box, obtaining and caching the mode of operation is that single choice or final election operate;
If the element type is button, obtains and cache the mode of operation to click button;
If the element type is date choice box, obtains and cache the mode of operation as date selection;
If the element type is menu, obtaining and caching the mode of operation is that menu is shown;
If the element type is picture box, obtaining and caching the mode of operation is that picture is shown;
If the element type is color selection box, obtains and cache the mode of operation as color selection;
If the element type is hyperlink label, obtaining and caching the mode of operation is page jump;
If the element type is list, obtaining and caching the mode of operation is that choosing is looked into list.
9. a kind of device of automatized script encapsulation, which is characterized in that described device includes: first acquisition unit, the second acquisition Unit, third acquiring unit and operating unit;
The first acquisition unit, for obtaining element property of the element on interface;
The second acquisition unit, for the element term and element class of the element to be obtained and cached according to the element property Type;The element term is visual title of the element at the interface;
The third acquiring unit, for obtaining and caching mode of operation corresponding with the element type;
The operating unit, for being obtained and the matched masurium of default test data from the element term of caching automatically Claim and is operated according to the mode of operation.
10. the device of automatized script encapsulation according to claim 9, which is characterized in that the first acquisition unit tool Body is used for the default interface property according to the interface, obtains all available elements that the default interface property includes automatically.
CN201910180415.4A 2019-03-11 2019-03-11 A kind of method and device of automatized script encapsulation Pending CN109933528A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910180415.4A CN109933528A (en) 2019-03-11 2019-03-11 A kind of method and device of automatized script encapsulation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910180415.4A CN109933528A (en) 2019-03-11 2019-03-11 A kind of method and device of automatized script encapsulation

Publications (1)

Publication Number Publication Date
CN109933528A true CN109933528A (en) 2019-06-25

Family

ID=66986735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910180415.4A Pending CN109933528A (en) 2019-03-11 2019-03-11 A kind of method and device of automatized script encapsulation

Country Status (1)

Country Link
CN (1) CN109933528A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111291208A (en) * 2020-05-09 2020-06-16 支付宝(杭州)信息技术有限公司 Front-end page element naming method and device and electronic equipment
CN111767228A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Interface testing method, device, equipment and medium based on artificial intelligence

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060184548A1 (en) * 2005-02-15 2006-08-17 International Business Machines Corporation Hierarchical inherited XML DOM
CN104008042A (en) * 2013-02-21 2014-08-27 阿里巴巴集团控股有限公司 UI (user interface) automated testing method, system and device
CN105471665A (en) * 2014-08-21 2016-04-06 北京奇虎科技有限公司 Website function testing method, website function testing system and website server
CN109189688A (en) * 2018-09-11 2019-01-11 北京奇艺世纪科技有限公司 A kind of generation method, generating means and the electronic equipment of test case script

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060184548A1 (en) * 2005-02-15 2006-08-17 International Business Machines Corporation Hierarchical inherited XML DOM
CN104008042A (en) * 2013-02-21 2014-08-27 阿里巴巴集团控股有限公司 UI (user interface) automated testing method, system and device
CN105471665A (en) * 2014-08-21 2016-04-06 北京奇虎科技有限公司 Website function testing method, website function testing system and website server
CN109189688A (en) * 2018-09-11 2019-01-11 北京奇艺世纪科技有限公司 A kind of generation method, generating means and the electronic equipment of test case script

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111291208A (en) * 2020-05-09 2020-06-16 支付宝(杭州)信息技术有限公司 Front-end page element naming method and device and electronic equipment
CN111767228A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Interface testing method, device, equipment and medium based on artificial intelligence
CN111767228B (en) * 2020-06-30 2024-02-06 深圳赛安特技术服务有限公司 Interface testing method, device, equipment and medium based on artificial intelligence

Similar Documents

Publication Publication Date Title
US11403364B2 (en) Method and terminal device for extracting web page content
CN107577509A (en) A kind of method, terminal and computer-readable recording medium for loading application interface
CN108572965A (en) A kind of resource loading method and device
CN105138340A (en) Interaction method and system for Native and Web pages
CN106610774B (en) Webpage table editing method and device
CN103218286A (en) Method and system for detecting accessibility of webpage
US10248392B2 (en) Replicating a web technology
CN108595697A (en) Webpage integrated approach, apparatus and system
CN105243407A (en) Method and device for reading and writing smart card
CN105224544A (en) A kind of data editing method of database and device
CN104375858A (en) Method and device for multiple browser platforms to execute javascript
CN105912328B (en) Display methods, device and the web system of the web system page
CN112068911B (en) Electronic form generation method, device, system, equipment and medium
CN109933528A (en) A kind of method and device of automatized script encapsulation
TW201441837A (en) System and method of loading control
CN109190069A (en) A kind of web page element modality management method, apparatus and electronic equipment
CN100383790C (en) HTTP web page dynamic outputting method and system
CN103226475A (en) Method and device for realizing control replacement during transcoding
CN111858595B (en) Dynamic configuration method and system for electric power engineering examination record table
CN113656000B (en) Webpage processing method and device
CN112068828A (en) Title control generation method, device, system, equipment and medium
CN114254229A (en) Webpage rendering method and device
CN104933019B (en) A kind of method and device that list generates
CN111079392A (en) Automatic filling method and device for webpage form, storage medium and electronic equipment
CN112817595A (en) Interface rendering method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190625