CN107451052A - One kind is based on Web system positioning webpage element test method - Google Patents
One kind is based on Web system positioning webpage element test method Download PDFInfo
- Publication number
- CN107451052A CN107451052A CN201710559136.XA CN201710559136A CN107451052A CN 107451052 A CN107451052 A CN 107451052A CN 201710559136 A CN201710559136 A CN 201710559136A CN 107451052 A CN107451052 A CN 107451052A
- Authority
- CN
- China
- Prior art keywords
- test
- web system
- xpath
- script
- test method
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses one kind to be based on Web system positioning webpage element test method, the method of testing is increased income by Selenium, based on the automation tools of lightweight, with reference to Java programming languages, for the test of the application program based on Web, WebDriver drivings are called to open tested Web system browser;In system under test (SUT), the XPath that tester is readily available element by Firebug+FirePath instruments specifies node, writes test script, specifies the attribute of node and property value to be transferred in findElement () method XPath is obtained;Testing results script, WebDriver drive control browser executions, the operation test object such as accurately entered, clicked on to the element in the page, completing automatic test.The operation based on the basic control of webpage is realized in the invention, analyzes webpage source code, positioning is more flexible, simple and convenient.
Description
Technical field
The present invention relates to mobile communication technology field, and in particular to one kind is based on Web system positioning webpage element test side
Method, it is specifically based on the Web automation positioning webpage element tests of Selenium2 (Selenium1+WebDriver) Open-Source Tools
Method.
Background technology
As the fast development and application program of Web applications are using more and more extensive, at the same time, to web application
Iteratively faster in quick project, manual test New function, automation returns old function, it is necessary to which the automation for doing high quality returns
Test.
The content of the invention
The invention aims to solve drawbacks described above of the prior art, there is provided one kind is based on Web system positioning page
Surface element method of testing, the operation based on the basic control of webpage is realized, analyze webpage source code, positioning is more flexible, simple and convenient.
The purpose of the present invention can be reached by adopting the following technical scheme that:
One kind is based on Web system positioning webpage element test method, and described method of testing comprises the following steps:
The address of the tested Web system of browser input is opened, opens the interface of tested Web system, obtains tested Web system
The element source code of main interface;
Source code and advanced location element XPath are inquired about by Firebug and FirePath plug-in units;
Obtain the page in keyboard in input frame input value and mouse click button, linking element as parameter;
Test script is write, findElement () or findElements () is transferred to and obtains different type parameter;
Testing results script is accurately entered to page elements, clicking operation test object.
Further, keyboard input value and mouse click button, linking element in input frame in the described acquisition page
It is specific as follows as parameter:
Mouse is placed in account text box, and attribute and category are navigated in FirePath XPath frames in the tab of the lower section rightmost side
Property value is // * [@id=' UserID '] element value, and the element value is XPath () bracket intrinsic parameter.
Further, it is described to write test script, it is transferred to findElement () or findElements () and obtains
Different type parameter is specific as follows:
// * [@id=' UserID '] elements are delivered in findElement () by By.xpath positioning.
Further, described testing results script page elements are accurately entered, clicking operation test object
It is specific as follows:
Selenium WebDriver control browser executions are called, page elements are accurately entered, click on behaviour
Make test object, complete automatic test.
The present invention is had the following advantages relative to prior art and effect:
One kind disclosed by the invention is based on Web system positioning webpage element test method, in being automated based on Selenium
XPath localization methods are more flexible, and support is searched for forward, also supports to search for backward, light by Firebug+FirePath instruments
The XPath for obtaining element specifies node, carries out automatic test and the operation test object such as accurately enters, clicks on, completes automatically
Change regression test.
Brief description of the drawings
Fig. 1 is a kind of process step figure based on Web system positioning webpage element test method disclosed by the invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Embodiment
Present embodiment discloses one kind to be based on Web system positioning webpage element test method, this method selection Selenium2
Automated test tool, for testing web application user interface (UI) Function Test Automation, Selenium2, which has, to be come
From WebDriver clear object-oriented API, and can be interacted with optimal user's mode of operation with browser.
Its a variety of browser (IE, Firefox, Chrome etc.) of support of Selenium 2 and multi-language binding.
Based on the operation of the basic control of webpage, webpage source code is analyzed, Selenium supports a variety of different types of locators,
Id, Name, XPath Locator, and CSS Locator etc., more flexible relative to XPath localization methods, support is searched forward
Rope, also support to search for backward.This method passes through Firebug+FirePath by Selenium Web system automation projects
The XPath that instrument is readily available element specifies node.Write test script transmission and obtain element parameter, complete automatic test.
1st, in the present embodiment, plug-in unit Firebug and FirePath plug-in unit is installed in Firefox browser.
2nd, as shown in figure 1, inputting tested Web system address in browser of the S101 steps in opening, source code is obtained.
In instances, the address of browser input system under test (SUT) is opened, the interface of system under test (SUT) is opened, that is, obtains the main boundary of system under test (SUT)
The element source code in face.
3rd, as shown in figure 1, S102 steps inquire about source code and advanced location element by Firebug and FirePath plug-in units
XPath.Right button checks element using Firebug in Web system, has a column functional block, analytical element code below Web page
Characteristic;There are FirePath tabs in the functional block Tab menus rightmost side, click on FirePath, then the left side arrow in functional block
Head character position, arrow is clicked on, mouse moves to the position for needing to position, and plug-in unit can navigate to corresponding HTML code,
Automatically generate XPath page elements.
4th, as shown in figure 1, S103 steps obtain keyboard input value and mouse click button, link in input frame in the page
Deng element as parameter.In embodiment, clicked in the account text box that mouse is moved in Web system, functional block Tab
The XPath of FirePath tabs in menu navigates to attribute and property value is // * [@id=' UserID '] element value, should
Element value is xpath () bracket intrinsic parameter in java codes.
5th, as shown in figure 1, S103 steps, write script, it is transferred to findElement () or findElements () is obtained
Obtain different type parameter.// * [@id=' UserID '] elements are delivered to findElement () by By.xpath positioning
In, location code is as follows:
Driver.findElement (By.xpath (" // * [@id='UserID'] ")) .sendKeys
(“userid”);
6th, as shown in figure 1, the operations such as S105 step testing results scripts are accurately entered to page elements, clicked on are surveyed
Try object.In instances, Selenium WebDriver control browser executions are called, page elements are carried out accurately defeated
The operation test object such as enter, click on, completing automatic test.
In summary, the invention discloses one kind to be based on Web system positioning webpage element test method, based on Selenium
XPath positions the benefit analysis of Web page object in automation, and locator is fairly simple, and flexibly, support is searched for forward, is also propped up
Hold and search for backward.Tester is only needed simply to understand html language, and element is obtained by Firebug+FirePath
XPath specifies node, writes test script and transmits element parameter, can directly run automatized script and carry out regression test, carry
High testing efficiency.
Above-described embodiment is the preferable embodiment of the present invention, but embodiments of the present invention are not by above-described embodiment
Limitation, other any Spirit Essences without departing from the present invention with made under principle change, modification, replacement, combine, simplification,
Equivalent substitute mode is should be, is included within protection scope of the present invention.
Claims (4)
1. one kind is based on Web system positioning webpage element test method, it is characterised in that described method of testing includes following step
Suddenly:
The address of the tested Web system of browser input is opened, opens the interface of tested Web system, obtains the tested main boundary of Web system
The element source code in face;
Source code and advanced location element XPath are inquired about by Firebug and FirePath plug-in units;
Obtain the page in keyboard in input frame input value and mouse click button, linking element as parameter;
Test script is write, findElement () or findElements () is transferred to and obtains different type parameter;
Testing results script is accurately entered to page elements, clicking operation test object.
2. one kind according to claim 1 is based on Web system positioning webpage element test method, it is characterised in that described
The acquisition page in keyboard input value and mouse click button, linking element in input frame it is specific as follows as parameter:
Mouse is placed in account text box, and attribute and property value are navigated in FirePath XPath frames in the tab of the lower section rightmost side
For // * [@id=' UserID '] element value, the element value is XPath () bracket intrinsic parameter.
3. one kind according to claim 1 is based on Web system positioning webpage element test method, it is characterised in that described
Write test script, being transferred to findElement () or findElements (), to obtain different type parameter specific as follows:
// * [@id=' UserID '] elements are delivered in findElement () by By.xpath positioning.
4. one kind according to claim 1 is based on Web system positioning webpage element test method, it is characterised in that described
Testing results script page elements are accurately entered, clicking operation test object it is specific as follows:
Selenium WebDriver control browser executions are called, page elements are accurately entered, clicking operation is surveyed
Object is tried, completes automatic test.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710559136.XA CN107451052A (en) | 2017-07-11 | 2017-07-11 | One kind is based on Web system positioning webpage element test method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710559136.XA CN107451052A (en) | 2017-07-11 | 2017-07-11 | One kind is based on Web system positioning webpage element test method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107451052A true CN107451052A (en) | 2017-12-08 |
Family
ID=60488856
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710559136.XA Pending CN107451052A (en) | 2017-07-11 | 2017-07-11 | One kind is based on Web system positioning webpage element test method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107451052A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108874435A (en) * | 2018-05-29 | 2018-11-23 | 郑州云海信息技术有限公司 | A kind of automatic method for refreshing of server B MC Web |
CN109254910A (en) * | 2018-08-08 | 2019-01-22 | 北京城市网邻信息技术有限公司 | A kind of test method of application program, device, electronic equipment and storage medium |
CN109542553A (en) * | 2018-10-26 | 2019-03-29 | 北京慧流科技有限公司 | The information extraction method and device and storage medium of user interface UI element |
CN110196614A (en) * | 2019-05-21 | 2019-09-03 | 苏州浪潮智能科技有限公司 | The method and device in the time zone WEB page UTC of automated setting BMC |
CN110618934A (en) * | 2019-08-15 | 2019-12-27 | 重庆金融资产交易所有限责任公司 | Front-end automatic test debugging method and device and computer readable storage medium |
CN110888810A (en) * | 2019-11-19 | 2020-03-17 | 广东润联信息技术有限公司 | Method and device for automatic identification and marking, computer equipment and storage medium |
CN110908907A (en) * | 2019-11-19 | 2020-03-24 | 泰康保险集团股份有限公司 | Web page testing method, device, equipment and storage medium |
CN111666220A (en) * | 2020-06-30 | 2020-09-15 | 成都新潮传媒集团有限公司 | Method and device for generating Web page object test file |
CN113239298A (en) * | 2021-06-18 | 2021-08-10 | 北京邮电大学 | Automatic capturing and inputting method and device for automatic test elements |
CN113918460A (en) * | 2021-10-15 | 2022-01-11 | 京东科技信息技术有限公司 | Page testing method, device, equipment and medium |
CN114356751A (en) * | 2021-12-13 | 2022-04-15 | 浪潮软件集团有限公司 | Method and device for automatically generating test script and computer readable medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020156772A1 (en) * | 1999-12-02 | 2002-10-24 | International Business Machines | Generating one or more XML documents from a single SQL query |
KR20110111980A (en) * | 2010-04-06 | 2011-10-12 | 경북대학교 산학협력단 | System and method for extrcting tuple in webpage using spatial join |
CN104424087A (en) * | 2013-08-21 | 2015-03-18 | 阿里巴巴集团控股有限公司 | Web page element positioning method, apparatus and system |
-
2017
- 2017-07-11 CN CN201710559136.XA patent/CN107451052A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020156772A1 (en) * | 1999-12-02 | 2002-10-24 | International Business Machines | Generating one or more XML documents from a single SQL query |
KR20110111980A (en) * | 2010-04-06 | 2011-10-12 | 경북대학교 산학협력단 | System and method for extrcting tuple in webpage using spatial join |
CN104424087A (en) * | 2013-08-21 | 2015-03-18 | 阿里巴巴集团控股有限公司 | Web page element positioning method, apparatus and system |
Non-Patent Citations (1)
Title |
---|
程佩: "基于Selenium WebDriver和Selendroid的自动化测试的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108874435A (en) * | 2018-05-29 | 2018-11-23 | 郑州云海信息技术有限公司 | A kind of automatic method for refreshing of server B MC Web |
CN109254910A (en) * | 2018-08-08 | 2019-01-22 | 北京城市网邻信息技术有限公司 | A kind of test method of application program, device, electronic equipment and storage medium |
CN109254910B (en) * | 2018-08-08 | 2022-09-02 | 北京城市网邻信息技术有限公司 | Application program testing method and device, electronic equipment and storage medium |
CN109542553A (en) * | 2018-10-26 | 2019-03-29 | 北京慧流科技有限公司 | The information extraction method and device and storage medium of user interface UI element |
CN110196614A (en) * | 2019-05-21 | 2019-09-03 | 苏州浪潮智能科技有限公司 | The method and device in the time zone WEB page UTC of automated setting BMC |
CN110618934A (en) * | 2019-08-15 | 2019-12-27 | 重庆金融资产交易所有限责任公司 | Front-end automatic test debugging method and device and computer readable storage medium |
CN110908907A (en) * | 2019-11-19 | 2020-03-24 | 泰康保险集团股份有限公司 | Web page testing method, device, equipment and storage medium |
CN110888810A (en) * | 2019-11-19 | 2020-03-17 | 广东润联信息技术有限公司 | Method and device for automatic identification and marking, computer equipment and storage medium |
CN111666220A (en) * | 2020-06-30 | 2020-09-15 | 成都新潮传媒集团有限公司 | Method and device for generating Web page object test file |
CN111666220B (en) * | 2020-06-30 | 2022-12-02 | 成都新潮传媒集团有限公司 | Method and device for generating Web page object test file |
CN113239298A (en) * | 2021-06-18 | 2021-08-10 | 北京邮电大学 | Automatic capturing and inputting method and device for automatic test elements |
CN113918460A (en) * | 2021-10-15 | 2022-01-11 | 京东科技信息技术有限公司 | Page testing method, device, equipment and medium |
CN114356751A (en) * | 2021-12-13 | 2022-04-15 | 浪潮软件集团有限公司 | Method and device for automatically generating test script and computer readable medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107451052A (en) | One kind is based on Web system positioning webpage element test method | |
US9424167B2 (en) | Automated testing of an application system | |
US8151276B2 (en) | Test script transformation analyzer with change guide engine | |
US7810070B2 (en) | System and method for software testing | |
US8745595B2 (en) | Information processing apparatus and method of acquiring trace log | |
Rauch et al. | Babylonian-style Programming: Design and Implementation of an Integration of Live Examples into General-purpose Source Code | |
US8635593B2 (en) | Dynamic autocompletion tool | |
CN107665168A (en) | A kind of embedded software GUI automated test devices | |
US20220350857A1 (en) | Methods and systems for browser extension used to generate relative xpath, absolute xpath and/or css selectors | |
CN103970662A (en) | Method and system for obtaining boundary value input through GUI software | |
JP2019074889A (en) | System, method, and program for automating business process involving operation of web browser | |
CN105224465A (en) | Webpage adjustment method and device | |
CN105630678B (en) | A kind of the reliability detector and its detection method of intelligent electric energy meter software | |
JP2019075084A (en) | System, method, and program for automating business process involving operation of web browser | |
US20230195825A1 (en) | Browser extension with automation testing support | |
Granda et al. | Towards a Model-Driven Testing Framework for GUI Test Cases Generation from User Stories. | |
CN104331358A (en) | Test management system and method | |
Leiva et al. | Automatic internationalization for just in time localization of web-based user interfaces | |
Li et al. | Script InSight: Using models to explore JavaScript code from the browser view | |
Guo et al. | A business process explorer: recovering and visualizing e-commerce business processes | |
CN113778437A (en) | RPA element accurate positioning method | |
Tramontana | Reverse engineering web applications | |
Kostaras et al. | What Is Apache NetBeans | |
CN113836450B (en) | Data interface generation method for acquiring XPATH based on visual operation | |
Sun et al. | Automating repetitive tasks on web-based ides via an editable and reusable capture-replay technique |
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: 20171208 |