CN105320603A - Locating system and method for browser page elements and automatic testing method thereof - Google Patents

Locating system and method for browser page elements and automatic testing method thereof Download PDF

Info

Publication number
CN105320603A
CN105320603A CN201510894057.5A CN201510894057A CN105320603A CN 105320603 A CN105320603 A CN 105320603A CN 201510894057 A CN201510894057 A CN 201510894057A CN 105320603 A CN105320603 A CN 105320603A
Authority
CN
China
Prior art keywords
page elements
locating
source code
defined terms
page
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
CN201510894057.5A
Other languages
Chinese (zh)
Other versions
CN105320603B (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.)
Shanghai Yuanxi Information Technology Co., Ltd.
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201510894057.5A priority Critical patent/CN105320603B/en
Publication of CN105320603A publication Critical patent/CN105320603A/en
Application granted granted Critical
Publication of CN105320603B publication Critical patent/CN105320603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the field of automatic testing, in particular to a locating system and method for browser page elements and an automatic testing method thereof. The locating method comprises the steps that a locating request is generated according to operation on the page elements; a front end source code of a page is analyzed according to the locating request, and locating content of the corresponding page elements in the front end source code is obtained; the obtained locating content is combined to generate locating results of the page elements. The locating system comprises a task starting module, a main program module and a processing module, wherein the task starting module generates and transmits the locating request according to the operation on the page elements, the main program module analyzes the front end source code of the page according to the locating request, and obtains the locating content of the corresponding page elements in the front end source code, and the processing module combines the obtained locating content of the page elements and generates the locating results of the page elements. The automatic testing method comprises the steps that the locating results are matched into testing tools according to the locating request, and the testing tools carry out automatic testing according to the locating results.

Description

The positioning system of browser page element and method and automated testing method thereof
Technical field
The present invention relates to automatic test field, particularly relate to a kind of positioning system of browser page element and method and automated testing method thereof.
Background technology
At present; all need to use some testing tools in a lot of automatic test; such as in the test to page elements content, often can use this automated test tool of RobotFramework; for this kind of testing tool of RobotFramework, need the positioning result of input to browser page element.Current way is, manually goes to search in the source code of page front end, captures out corresponding element positioning result in the source code of front end, and is input in testing tool by the element positioning result captured out.This mode not only needs a large amount of human costs, inefficiency, and the accuracy obtaining element locating content is low, easily causes the inaccurate problem of test result.
Summary of the invention
For problems of the prior art, the invention provides a kind of positioning system of browser page element and method and automated testing method thereof, can accurately locate the element of browser page accurately, more quick and easy when using RobotFramework to write test script, and effectively improve the efficiency of compile script.
The present invention adopts following technical scheme:
A localization method for browser page element, described localization method comprises:
Location Request is produced according to the operation of page elements;
Resolve according to the front end source code of described Location Request to the page, and obtain the locating content of page elements corresponding in the source code of described front end;
The described locating content obtained is combined, and produces the positioning result of described page elements.
Preferably, comprised before the step of Location Request is produced to the operation of page elements:
Preset the definition vocabulary that comprises multiple defined terms, at least corresponding described Location Request of each described defined terms;
Resolve according to the front end source code of described Location Request to the page, and the step obtaining the locating content of page elements corresponding in the source code of described front end specifically comprises:
Described defined terms corresponding in described definition vocabulary is obtained according to described Location Request;
Described defined terms according to obtaining is resolved described front end source code, obtains content corresponding with described defined terms in the source code of described front end, and using the described content of acquisition as described page elements locating content.
Preferably, the step that the described page elements locating content obtained carries out combining specifically is comprised: the corresponding content obtained from the source code of described front end according to described defined terms is integrated.
Preferably, in described method, described defined terms comprises: address and/or title and/or path and/or route text.
Preferably, the described locating content obtained is combined, and also comprises after producing the step of the positioning result of described page elements: the positioning result showing described page elements.
A positioning system for browser page element, is characterized in that, be applied in the page elements position fixing process of automatic test, described positioning system comprises:
Task start module, according to producing the operation of page elements and sending Location Request;
Main program module, with described task start model calling, resolves according to the front end source code of described Location Request to the page, and obtains the locating content of page elements corresponding in the source code of described front end;
Processing module, is connected with described main program module, is combined by the locating content of the described page elements obtained, produces the positioning result of described page elements.
Preferably, described positioning system also comprises:
Definition memory module, store a definition vocabulary, described definition vocabulary comprises multiple defined terms, and at least corresponding described Location Request of each defined terms;
Described main program module comprises:
Defined terms acquiring unit, obtains defined terms corresponding in described definition vocabulary according to described Location Request;
Resolution unit, the described defined terms according to obtaining is resolved described front end source code, and obtains content corresponding with described defined terms in the source code of described front end, and using the content of acquisition as element locating content.
Preferably, the described locating content of the correspondence obtained from the source code of described front end according to described defined terms is integrated by described processing module, obtains described positioning result.
Preferably, the positioning system of described browser page element also comprises:
Display module, is connected with described processing module, shows the positioning result of described page elements.
A kind of automated testing method, described automated testing method comprises:
Be matched in testing tool by above-mentioned positioning result according to described Location Request, described testing tool carries out automatic test according to described positioning result.
The invention has the beneficial effects as follows:
The present invention is after unlatching native system, as long as the page elements of user to browser operates, a button small icon will be ejected in side, now click this button small icon and will eject a display box, it is exactly its element positioning result in display box, this location mechanism has very large effect for compile script in automatic test, such as the most frequently used at present RobotFramework automated test frame, just need when writing case to carry out element location, existing location mechanism is or can not satisfies the demands, some problems that the present invention exists in effectively solving and locating at present, substantially increase testing efficiency.
Accompanying drawing explanation
Fig. 1 is the structural representation of the positioning system of a kind of browser page element of the present invention;
Fig. 2 is the corresponding relation figure in main program module of the present invention between Location Request and locating content;
Fig. 3 is the schematic diagram of the localization method of browser page element of the present invention.
Embodiment
It should be noted that, when not conflicting, following technical proposals, can combine between technical characteristic mutually.
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is further described:
Embodiment one
As shown in Figure 1, present embodiments provide the method for a kind of browser page element location, the present embodiment is mainly used in the process positioned browser page element, when user operates at browser page element, user can obtain the prompting of an inquiry property afterwards, namely confirm whether producing Location Request, if user confirms to produce Location Request, then task start module produces Location Request, this Location Request can be an instruction, and the content of instruction can be mainly the value obtaining defined terms in Location Request.Wherein, page elements can be the content of the display such as word, picture on browser page, the operation that user carries out can be the word and/or picture etc. chosen in browser, the positioning system of the browser page element in the present embodiment, can comprise: task start module, main program module, processing module.
First, the operation of the page elements that task start module can be selected according to user produces and sends Location Request, application scenarios can be: user selectes certain section of word of a browser page, browser page ejects the icon whether send Location Request more afterwards, and user can carry out click to this icon and confirm produce and send Location Request, main program module, can with task start model calling, resolve according to the front end source code of Location Request to the page, and obtain the locating content of page elements corresponding in the source code of described front end, the main resolving of task start module is: before carrying out resolving, have a definition memory module to be pre-stored with a definition vocabulary, this definition vocabulary comprises multiple defined terms, and defined terms acquiring unit can obtain defined terms corresponding in this definition vocabulary according to Location Request after at least corresponding Location Request of each defined terms, described front end source code is resolved according to the defined terms obtained by resolution unit again, and obtain content corresponding with described defined terms in the source code of front end, and using the content of acquisition as element locating content.Acquisition defined terms is eliminated in Fig. 2, and according to the process of defined terms determination locating content, as commend (Location Request) hurdle input in 2 is the instruction of Location Request, and Target (object content) hurdle is namely by locating content that above-mentioned resolving obtains, such as, the first row in Fig. 2, click both can be the instruction of Location Request, can determine in above-mentioned definition vocabulary that defined terms corresponding to this instruction of click is link according to the such positioning instruction of click, resolution unit is resolved front end source code according to the defined terms link obtained, obtaining locating content is summary.But the defined terms in the present embodiment is not limited to limit in table, can add as the case may be.
Processing module is connected with main program module, is combined by the locating content of the page elements of acquisition, produces the positioning result of page elements.In the present invention's preferred embodiment, locating content is integrated by processing module, obtains positioning result.In the above embodiments, the locating content obtained can simply be enumerated by processing module, is integration, enumerates be combination if need to carry out the conversion such as arrangement restructuring.After locating content processes by processing module, both can obtain positioning result, positioning result can be shown by a display module, and display module, is connected with processing module, can the positioning result of display page element.
Embodiment two
As shown in Figure 3, based on above-mentioned system, present embodiments provide a kind of localization method of browser page element, the concrete steps of this localization method comprise: first preset the definition vocabulary that comprises multiple defined terms, the at least corresponding Location Request of each defined terms, namely Location Request and a defined terms have corresponding relation, user can operate page elements afterwards, Location Request can be produced according to the operation of page elements, preferably, whether can be produced the process of request by an inquiry before producing Location Request, if user confirms, then request can be produced.As shown in Figure 3, the page elements of user Quan Xuan or the required location of click, start above-mentioned positioning system afterwards, the side of the page elements chosen there will be icon, clicks the icon that side occurs, confirmation produces Location Request.
Browser backstage responds according to the front end source code of Location Request to the page, resolves, and obtain the locating content of page elements corresponding in the source code of front end, above-mentioned steps is specifically as follows and obtains defined terms corresponding in definition vocabulary according to Location Request, this defined terms can for resolving front end source code according to the defined terms obtained, obtain content corresponding with defined terms in the source code of front end, and using the content of acquisition as page elements locating content.Wherein defined terms can comprise: address (ID) and/or title (name) and/or path (xpath) and/or route text (linktext).But defined terms is not limited to above-mentioned enumerating, can carry out as the case may be adding or selecting.
Afterwards, browser is inner to be combined the described locating content obtained, and produces the positioning result of described page elements.Wherein combination can be to operations such as locating content rearrange.Preferably, the locating content obtained from the source code of front end according to defined terms is carried out integration process, integration can be simply enumerate, and does not need to carry out sorting etc. step.Afterwards positioning result is fed back, the positioning result of display page element in text box.
Embodiment three
The automatic test that the present embodiment carries out based on the system and method for above-described embodiment one and embodiment two, positioning result can be obtained according to above-mentioned system and method, no longer the step obtaining positioning result is repeated herein, after obtaining positioning result, positioning result coupling can be inputed in testing tool according to Location Request, in testing tool, Location Request can a corresponding positioning result, and testing tool carries out automatic test according to positioning result more afterwards.
In sum, the present invention is after unlatching native system, as long as the page elements of user to browser operates, a button small icon will be ejected in side, now click this button small icon and will eject a display box, it is exactly its element positioning result in display box, this location mechanism has very large effect for compile script in automatic test, such as the most frequently used at present RobotFramework automated test frame, just need when writing case to carry out element location, existing location mechanism is or can not satisfies the demands, some problems that the present invention exists in effectively solving and locating at present, substantially increase testing efficiency.
By illustrating and accompanying drawing, giving the exemplary embodiments of the ad hoc structure of embodiment, based on the present invention's spirit, also can do other conversion.Although foregoing invention proposes existing preferred embodiment, but these contents are not as limitation.
For a person skilled in the art, after reading above-mentioned explanation, various changes and modifications undoubtedly will be apparent.Therefore, appending claims should regard the whole change and correction of containing true intention of the present invention and scope as.In Claims scope, the scope of any and all equivalences and content, all should think and still belong to the intent and scope of the invention.

Claims (10)

1. a localization method for browser page element, is characterized in that, described localization method comprises:
Location Request is produced according to the operation of page elements;
Resolve according to the front end source code of described Location Request to the page, and obtain the locating content of page elements corresponding in the source code of described front end;
The described locating content obtained is combined, and produces the positioning result of described page elements.
2. the localization method of browser page element according to claim 1, is characterized in that, comprises before producing the step of Location Request to the operation of page elements:
Preset the definition vocabulary that comprises multiple defined terms, at least corresponding described Location Request of each described defined terms;
Resolve according to the front end source code of described Location Request to the page, and the step obtaining the locating content of page elements corresponding in the source code of described front end specifically comprises:
Described defined terms corresponding in described definition vocabulary is obtained according to described Location Request;
Described defined terms according to obtaining is resolved described front end source code, obtains content corresponding with described defined terms in the source code of described front end, and using the described content of acquisition as described page elements locating content.
3. the localization method of browser page element according to claim 2, it is characterized in that, the step that the described page elements locating content obtained carries out combining specifically is comprised: the corresponding content obtained from the source code of described front end according to described defined terms is integrated.
4. the localization method of the browser page element according to any one of Claims 2 or 3, is characterized in that, in described method, described defined terms comprises: address and/or title and/or path and/or route text.
5. the localization method of browser page element according to claim 1, it is characterized in that, the described locating content obtained is combined, and also comprises after producing the step of the positioning result of described page elements: the positioning result showing described page elements.
6. a positioning system for browser page element, is characterized in that, be applied in the page elements position fixing process of automatic test, described positioning system comprises:
Task start module, according to producing the operation of page elements and sending Location Request;
Main program module, with described task start model calling, resolves according to the front end source code of described Location Request to the page, and obtains the locating content of page elements corresponding in the source code of described front end;
Processing module, is connected with described main program module, is combined by the locating content of the described page elements obtained, produces the positioning result of described page elements.
7. the positioning system of browser page element according to claim 6, is characterized in that, described positioning system also comprises:
Definition memory module, store a definition vocabulary, described definition vocabulary comprises multiple defined terms, and at least corresponding described Location Request of each defined terms;
Described main program module comprises:
Defined terms acquiring unit, obtains defined terms corresponding in described definition vocabulary according to described Location Request;
Resolution unit, the described defined terms according to obtaining is resolved described front end source code, and obtains content corresponding with described defined terms in the source code of described front end, and using the content of acquisition as element locating content.
8. the positioning system of browser page element according to claim 7, is characterized in that, the described locating content of the correspondence obtained from the source code of described front end according to described defined terms is integrated by described processing module, obtains described positioning result.
9. the positioning system of browser page element according to claim 6, is characterized in that, the positioning system of described browser page element also comprises:
Display module, is connected with described processing module, shows the positioning result of described page elements.
10. an automated testing method, is characterized in that, described automated testing method comprises:
Be matched in testing tool by the positioning result of claim 1 or 6 described in any one according to Location Request, described testing tool carries out automatic test according to described positioning result.
CN201510894057.5A 2015-12-04 2015-12-04 The alignment system and method and its automated testing method of browser page element Active CN105320603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510894057.5A CN105320603B (en) 2015-12-04 2015-12-04 The alignment system and method and its automated testing method of browser page element

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510894057.5A CN105320603B (en) 2015-12-04 2015-12-04 The alignment system and method and its automated testing method of browser page element

Publications (2)

Publication Number Publication Date
CN105320603A true CN105320603A (en) 2016-02-10
CN105320603B CN105320603B (en) 2018-04-06

Family

ID=55248021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510894057.5A Active CN105320603B (en) 2015-12-04 2015-12-04 The alignment system and method and its automated testing method of browser page element

Country Status (1)

Country Link
CN (1) CN105320603B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776319A (en) * 2016-12-15 2017-05-31 广州酷狗计算机科技有限公司 Automatic test approach and device
CN106991045A (en) * 2017-03-24 2017-07-28 广州酷狗计算机科技有限公司 Page method of calibration and device
CN112181412A (en) * 2020-09-27 2021-01-05 的卢技术有限公司 Ui element positioning method, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521121A (en) * 2011-11-18 2012-06-27 华为技术有限公司 Page testing method and page testing device
US20130024838A1 (en) * 2011-07-18 2013-01-24 Huawei Technologies Co., Ltd. Method, system and terminal for locating
CN103377127A (en) * 2012-04-28 2013-10-30 阿里巴巴集团控股有限公司 Development testing system, testing method and device for webpage product
CN104657377A (en) * 2013-11-20 2015-05-27 阿里巴巴集团控股有限公司 Multi-channel webpage control positioning method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130024838A1 (en) * 2011-07-18 2013-01-24 Huawei Technologies Co., Ltd. Method, system and terminal for locating
CN102521121A (en) * 2011-11-18 2012-06-27 华为技术有限公司 Page testing method and page testing device
CN103377127A (en) * 2012-04-28 2013-10-30 阿里巴巴集团控股有限公司 Development testing system, testing method and device for webpage product
CN104657377A (en) * 2013-11-20 2015-05-27 阿里巴巴集团控股有限公司 Multi-channel webpage control positioning method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIUCHUNMING033: "【selenium学习笔记】webdriver进行页面元素定位", 《HTTP://BLOG.CSDN.NET/LIUCHUNMING033/ARTICLE/DETAILS/46789085》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776319A (en) * 2016-12-15 2017-05-31 广州酷狗计算机科技有限公司 Automatic test approach and device
CN106776319B (en) * 2016-12-15 2020-02-14 广州酷狗计算机科技有限公司 Automatic test method and device
CN106991045A (en) * 2017-03-24 2017-07-28 广州酷狗计算机科技有限公司 Page method of calibration and device
CN112181412A (en) * 2020-09-27 2021-01-05 的卢技术有限公司 Ui element positioning method, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN105320603B (en) 2018-04-06

Similar Documents

Publication Publication Date Title
WO2018000998A1 (en) Interface generation method, apparatus and system
US20180060420A1 (en) Method and apparatus for natural language query in a workspace analytics system
CN109542412A (en) Interface message generation method, device, computer equipment and storage medium
CN110955416A (en) Interface document generation method, device, equipment and computer storage medium
US20170351691A1 (en) Search method and apparatus
CN105760290A (en) Problem positioning method based on web front-end testing as well as related device and system
CN110765001B (en) Modularized automatic test method and device for application system
CN104166645A (en) Interest point and path information obtaining method and vehicle-mounted electronic equipment
CN111159982B (en) Document editing method, device, electronic equipment and computer readable storage medium
KR20160125401A (en) Inline and context aware query box
CN105320603A (en) Locating system and method for browser page elements and automatic testing method thereof
CN104598578A (en) Picture searching method and picture searching device
CN104572946A (en) Method and device for processing data of yellow pages
US9965679B2 (en) Capturing specific information based on field information associated with a document class
CN103279457A (en) Method and device for generating diagram based on Excel
CN109978430A (en) A kind of method, apparatus, server and storage medium parsing station address
US20140149854A1 (en) Server and method for generating object document
CN106919374B (en) Script generation method and device
JP2019101889A (en) Test execution device and program
CN105700866A (en) RTE code generating method and apparatus performing the same
CN102722490B (en) A character-capturing method and a character-capturing device of an electronic reader and the same
CN102117293B (en) Dynamic file positioning and query method
CN110309499B (en) Device for generating examination report and method for generating examination report online
KR101449725B1 (en) Apparatus and method for converting pdf document
US20190272087A1 (en) Interface filtering method and system

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
TR01 Transfer of patent right

Effective date of registration: 20201103

Address after: 318015 no.2-3167, zone a, Nonggang City, no.2388, Donghuan Avenue, Hongjia street, Jiaojiang District, Taizhou City, Zhejiang Province

Patentee after: Taizhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220812

Address after: Room 106, 1st Floor, Building 7, No. 7001, Zhongchun Road, Minhang District, Shanghai, 201100

Patentee after: Shanghai Yuanxi Information Technology Co., Ltd.

Address before: 318015 no.2-3167, area a, nonggangcheng, 2388 Donghuan Avenue, Hongjia street, Jiaojiang District, Taizhou City, Zhejiang Province

Patentee before: Taizhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right