CN105320603B - The alignment system and method and its automated testing method of browser page element - Google Patents

The alignment system and method and its automated testing method of browser page element Download PDF

Info

Publication number
CN105320603B
CN105320603B CN201510894057.5A CN201510894057A CN105320603B CN 105320603 B CN105320603 B CN 105320603B CN 201510894057 A CN201510894057 A CN 201510894057A CN 105320603 B CN105320603 B CN 105320603B
Authority
CN
China
Prior art keywords
content
page
source code
location request
positioning
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510894057.5A
Other languages
Chinese (zh)
Other versions
CN105320603A (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

Abstract

The present invention relates to the alignment system and method and its automated testing method in automatic test field, more particularly to a kind of browser page element.Localization method includes:Location Request is produced according to the operation to page elements;The front end source code of the page is parsed according to Location Request, obtains the positioning content of corresponding page elements in the source code of front end;The positioning content of acquisition is combined, produces the positioning result of page elements.Alignment system includes:Task start module, produced according to the operation to page elements and send Location Request;Main program module, the front end source code of the page is parsed according to Location Request, and obtain the positioning content of corresponding page elements in the source code of front end;Processing module, the positioning content of the page elements of acquisition is combined, produces the positioning result of page elements.Automated testing method includes:Above-mentioned positioning result is matched in testing tool according to Location Request, testing tool carries out automatic test according to positioning result.

Description

The alignment system and method and its automated testing method of browser page element
Technical field
The present invention relates to automatic test field, more particularly to a kind of alignment system of browser page element and method and Its automated testing method.
Background technology
At present, it is required for using some testing tools in many automatic tests, such as to page elements content Often using this automated test tool of Robot Framework in test, for this class testing of Robot Framework Instrument is, it is necessary to input the positioning result to browser page element.Current way is manually to go in the source code of page front end to carry out Search, capture out corresponding element positioning result in the source code of front end, and the element positioning result captured out is input to test work In tool.This mode not only needs substantial amounts of human cost, and efficiency is low, and the accuracy for obtaining element positioning content is low, The problem of easily causing test result inaccuracy.
The content of the invention
For problems of the prior art, the invention provides a kind of alignment system of browser page element and side Method and its automated testing method, accurately the element of browser page can be accurately positioned, use Robot Framework writes more quick and easy during test script, and effectively improves the efficiency for writing script.
The present invention adopts the following technical scheme that:
A kind of localization method of browser page element, the localization method include:
Location Request is produced according to the operation to page elements;
The front end source code of the page is parsed according to the Location Request, and obtains corresponding page in the front end source code The positioning content of surface element;
The positioning content of acquisition is combined, and produces the positioning result of the page elements.
Preferably, include before the step of producing Location Request according to the operation to page elements:
Default one includes the definition vocabulary of multiple defined terms, and at least corresponding positioning of each defined terms please Ask;
The front end source code of the page is parsed according to the Location Request, and obtains corresponding page in the front end source code The step of positioning content of surface element, specifically includes:
The corresponding defined terms in the definition vocabulary is obtained according to the Location Request;
The front end source code is parsed according to the defined terms of acquisition, obtain in the front end source code with it is described fixed Content corresponding to adopted word, and position content using the content of acquisition as the page elements.
Preferably, the step of page elements positioning content of acquisition being combined specifically includes:Will be according to described The corresponding content that defined terms obtains from the front end source code is integrated.
Preferably, in methods described, the defined terms includes:Address and/or title and/or path and/or route text.
Preferably, the positioning content of acquisition is combined, and produces the step of the positioning result of the page elements Also include after rapid:Show the positioning result of the page elements.
A kind of alignment system of browser page element, it is characterised in that the page elements applied to automatic test are determined During position, the alignment system includes:
Task start module, produced according to the operation to page elements and send Location Request;
Main program module, it is connected with the task start module, the front end source code of the page is entered according to the Location Request Row parsing, and obtain the positioning content of corresponding page elements in the front end source code;
Processing module, it is connected with the main program module, the positioning content of the page elements of acquisition is combined, Produce the positioning result of the page elements.
Preferably, the alignment system also includes:
Memory module is defined, is stored with a definition vocabulary, the vocabulary that defines includes multiple defined terms, and each definition Word at least corresponds to a Location Request;
The main program module includes:
Defined terms acquiring unit, corresponding defined terms in the definition vocabulary is obtained according to the Location Request;
Resolution unit, the front end source code is parsed according to the defined terms of acquisition, and obtain the front-end source Content corresponding with the defined terms in code, and position content using the content of acquisition as element.
Preferably, the processing module will be obtained according to the defined terms from the front end source code corresponding to it is described fixed Position content is integrated, and obtains the positioning result.
Preferably, the alignment system of the browser page element also includes:
Display module, it is connected with the processing module, shows the positioning result of the page elements.
A kind of automated testing method, the automated testing method include:
Above-mentioned positioning result is matched in testing tool according to the Location Request, the testing tool is according to Positioning result carries out automatic test.
The beneficial effects of the invention are as follows:
The present invention is after the system is opened, as long as user operates to the page elements of browser, side will eject One button small icon, a display box will be ejected by now clicking on this button small icon, be exactly that its element is determined in display box Position result, this location mechanism play the role of very big, such as the most frequently used Robot at present for writing script in automatic test Framework automated test frames, just need to position into row element when writing case, existing location mechanism is or not Energy meet demand, the present invention is effective to solve some problems present in positioning at present, substantially increases testing efficiency.
Brief description of the drawings
Fig. 1 is a kind of structural representation of the alignment system of browser page element of the present invention;
Fig. 2 is the corresponding relation figure between Location Request and positioning content in main program module of the present invention;
Fig. 3 is the schematic diagram of the localization method of browser page element of the present invention.
Embodiment
It should be noted that in the case where not conflicting, following technical proposals, can be mutually combined between technical characteristic.
The embodiment of the present invention is further described below in conjunction with the accompanying drawings:
Embodiment one
As shown in figure 1, present embodiments providing a kind of method of browser page element positioning, the present embodiment is mainly applied In in the process positioned to browser page element, when user is operated in browser page element, user afterwards The prompting of an inquiry property can be obtained, i.e., to whether producing Location Request and confirming, if user confirms to produce Location Request, Task start module produces Location Request, and the Location Request can be an instruction, and the content of instruction can be determined The value of word defined in the request of position.Wherein, page elements can be the content of the displays such as word on browser page, picture, use The operation that family is carried out can choose word and/or picture in browser etc., the browser page element in the present embodiment Alignment system, it can include:Task start module, main program module, processing module.
First, task start module can produce according to the operation for the page elements that user selectes and send Location Request, should Can be with scene:User selectes certain section of word of a browser page, and whether browser page ejection one sends again afterwards The icon of Location Request, user can carry out clicking on to the icon to be confirmed to produce and send Location Request;Main program module, can be with It is connected, the front end source code of the page is parsed according to Location Request, and obtain in the front end source code with task start module The positioning content of corresponding page elements, the main resolving of task start module are:Have one before resolving is carried out Define memory module and be pre-stored with a definition vocabulary, this definition vocabulary includes multiple defined terms, and each defined terms is at least right Defined terms acquiring unit can obtain corresponding defined terms in this definition vocabulary according to Location Request after answering a Location Request, The front end source code is parsed according to the defined terms of acquisition by resolution unit again, and obtain in the source code of front end with the definition Content corresponding to word, and position content using the content of acquisition as element.Acquisition defined terms is eliminated in Fig. 2, and according to definition Word determines the process of positioning content, as in 2 the columns of commend (Location Request) one input be Location Request instruction, and The columns of Target (object content) one are the positioning content obtained by above-mentioned resolving, for example, the first row in Fig. 2, Click both can be the instruction of Location Request, be positioned such that instruction can determine in above-mentioned definition vocabulary according to click Defined terms corresponding to this instruction of click is link, and resolution unit solves according to the defined terms link of acquisition to front end source code Analysis, it is summary to obtain positioning content.But the defined terms in the present embodiment is not limited to limit in table, can enter as the case may be Row addition.
Processing module is connected with main program module, and the positioning content of the page elements of acquisition is combined, and produces the page The positioning result of element.In a preferred embodiment of the invention, processing module is integrated content is positioned, and obtains positioning knot Fruit.In the above embodiments, processing module can simply be enumerated obtained positioning content, as be integrated, if needing Arrange the conversion such as restructuring to enumerate as combining.It will position after content handled in processing module, can both be positioned As a result, positioning result can be shown by a display module, display module, be connected with processing module, can show page member The positioning result of element.
Embodiment two
As shown in figure 3, based on above-mentioned system, a kind of localization method of browser page element is present embodiments provided, The specific steps of the localization method include:First default one includes the definition vocabulary of multiple defined terms, and each defined terms is at least right A Location Request is answered, i.e. Location Request has corresponding relation with a defined terms, and user can operate to page elements afterwards, root Location Request can be produced according to the operation to page elements, it is preferred that can be asked whether before Location Request is produced by one The process of request is produced, if user confirms, request can be produced.As shown in figure 3, positioning needed for user Quan Xuan or click Page elements, start above-mentioned alignment system afterwards, icon occurs beside the page elements chosen, click on what side occurred Icon, confirm to produce Location Request.
Browser backstage is responded to the front end source code of the page according to Location Request, parsed, and is obtained in the source code of front end The positioning content of corresponding page elements, above-mentioned steps are specifically as follows according to corresponding fixed in Location Request acquisition definition vocabulary Adopted word, the defined terms that this definition word can obtain according to parse to front end source code, obtain in the source code of front end with defined terms Corresponding content, and position content using the content of acquisition as page elements.Wherein defined terms can include:Address (ID) and/ Or title (name) and/or path (xpath) and/or route text (linktext).But defined terms be not limited to it is above-mentioned enumerate, It can be added or select as the case may be.
Afterwards, the positioning content of acquisition is combined inside browser, and produces the positioning of the page elements As a result.Wherein combination can be that positioning content is carried out the operation such as rearranging.Preferably, will be according to defined terms from front end source code The positioning content of middle acquisition carries out integration processing, and integration can simply be enumerated, it is not necessary to the step such as is ranked up.Afterwards will Positioning result is fed back, and the positioning result of page elements is shown in text box.
Embodiment three
The automatic test that the present embodiment is carried out based on the system and method for above-described embodiment one and embodiment two, according to upper The system and method stated can obtain positioning result, herein no longer to obtaining positioning result the step of repeat, determined After the result of position, positioning result matching can be inputted into testing tool according to Location Request, in testing tool, a positioning Request can correspond to a positioning result, and testing tool carries out automatic test further according to positioning result afterwards.
In summary, the present invention is after the system is opened, as long as user operates to the page elements of browser, side A button small icon will be ejected, a display box will be ejected by now clicking on this button small icon, be exactly it in display box Element positioning result, this location mechanism for write in automatic test script play the role of it is very big, such as at present it is most normal Robot Framework automated test frames, just need to position into row element when writing case, existing localization machine System is or is unable to meet demand, and the present invention is effective to solve some problems present in positioning at present, substantially increases survey Try efficiency.
By explanation and accompanying drawing, the exemplary embodiments of the specific structure of embodiment are given, it is smart based on the present invention God, it can also make other conversions.Although foregoing invention proposes existing preferred embodiment, however, these contents are not intended as Limitation.
For a person skilled in the art, after reading described above, various changes and modifications undoubtedly will be evident. Therefore, appended claims should regard whole variations and modifications of the true intention and scope that cover the present invention as.Weighing Any and all scope and content of equal value, are all considered as still belonging to the intent and scope of the invention in the range of sharp claim.

Claims (3)

1. a kind of localization method of browser page element, it is characterised in that the localization method includes:
Location Request is produced according to the operation to page elements;
The front end source code of the page is parsed according to the Location Request, and obtains corresponding page member in the front end source code The positioning content of element;
The positioning content of acquisition is combined, and produces the positioning result of the page elements;
Include before the step of producing Location Request according to the operation to page elements:
Default one includes the definition vocabulary of multiple defined terms, and each defined terms at least corresponds to a Location Request;
The front end source code of the page is parsed according to the Location Request, and obtains corresponding page member in the front end source code The step of positioning content of element, specifically includes:
The corresponding defined terms in the definition vocabulary is obtained according to the Location Request;
The front end source code is parsed according to the defined terms of acquisition, obtain in the front end source code with the defined terms Corresponding content, and position content using the content of acquisition as the page elements;
The step of page elements positioning content of acquisition is combined specifically includes:Will be according to the defined terms from described The corresponding content obtained in the source code of front end is integrated;
The defined terms includes:Address and/or title and/or path and/or route text;
Also wrapped after the step of positioning content of acquisition is combined, and produces the positioning result of the page elements Include:Show the positioning result of the page elements.
2. a kind of alignment system of browser page element, it is characterised in that the page elements applied to automatic test position During, the alignment system includes:
Task start module, produced according to the operation to page elements and send Location Request;
Main program module, it is connected with the task start module, the front end source code of the page is solved according to the Location Request Analysis, and obtain the positioning content of corresponding page elements in the front end source code;
Processing module, it is connected with the main program module, the positioning content of the page elements of acquisition is combined, is produced The positioning result of the page elements;
The alignment system also includes:
Memory module is defined, is stored with a definition vocabulary, the vocabulary that defines includes multiple defined terms, and each defined terms is extremely A Location Request is corresponded to less;
The main program module includes:
Defined terms acquiring unit, corresponding defined terms in the definition vocabulary is obtained according to the Location Request;
Resolution unit, the front end source code is parsed according to the defined terms of acquisition, and obtained in the front end source code Content corresponding with the defined terms, and position content using the content of acquisition as element;
The processing module will be obtained according to the defined terms from the front end source code corresponding to it is described positioning content carry out Integrate, obtain the positioning result;
The alignment system of the browser page element also includes:
Display module, it is connected with the processing module, shows the positioning result of the page elements.
3. a kind of automated testing method, it is characterised in that the automated testing method includes:
Any one of positioning result of claim 1 or 2 is matched in testing tool according to Location Request, the test Instrument carries out automatic test according to the 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 CN105320603A (en) 2016-02-10
CN105320603B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Citations (3)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012106901A1 (en) * 2011-07-18 2012-08-16 华为技术有限公司 Web-based script language editing method, system and web client

Patent Citations (3)

* 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
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
【selenium学习笔记】webdriver进行页面元素定位;liuchunming033;《http://blog.csdn.net/liuchunming033/article/details/46789085》;20150707;第1-6页 *

Also Published As

Publication number Publication date
CN105320603A (en) 2016-02-10

Similar Documents

Publication Publication Date Title
CN100583920C (en) Method and apparatus for generating testing script, testing method, apparatus and system
US20180060420A1 (en) Method and apparatus for natural language query in a workspace analytics system
DE102017128904A1 (en) Intrinsically safe, portable field maintenance tool with improved help function
CA2684822C (en) Data transformation based on a technical design document
CN105320603B (en) The alignment system and method and its automated testing method of browser page element
CN101101205A (en) Inspection apparatus for inspecting articles
CN105760290A (en) Problem positioning method based on web front-end testing as well as related device and system
US20080140694A1 (en) Data transformation between databases with dissimilar schemes
US8381164B2 (en) Method and system of intelligent interactive graphics electrical plug map to analyze text and distances between electrical contacts and physical layout file builder
CN108170734A (en) A kind of intelligence O&M robot
CN103777858B (en) Method for displaying textbox and device
US20200026802A1 (en) Image quality independent searching of screenshots of web content
CN105630681A (en) Automatic test method and system based on WEB behavior drive
CN105677716A (en) Computer data acquisition, processing and analysis system
CN104375940A (en) Debugging method for JavaScript files
CN113049935A (en) Semiconductor intelligent detection system, intelligent detection method and storage medium
CN106919501A (en) Static Analysis Method and instrument based on defect mode
CN107977419B (en) Nuclear power station DCS operation and maintenance support file identification method and system
US20180321959A1 (en) Context oriented translation
CN109710808A (en) A kind of analytic method of XML file, system, device and readable storage medium storing program for executing
US20140032420A1 (en) Method for providing solution of peripheral technique
CN102663205B (en) Software realization method and system for vehicle assembly shop tooling site management
US20200142817A1 (en) Smart Template Test Framework
US20120123990A1 (en) Method And Device For The Quality Analysis Of System Models
CN110335637B (en) Method and device for testing storage equipment and equipment

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