CN115904934A - Webpage testing method and related device - Google Patents
Webpage testing method and related device Download PDFInfo
- Publication number
- CN115904934A CN115904934A CN202211158047.1A CN202211158047A CN115904934A CN 115904934 A CN115904934 A CN 115904934A CN 202211158047 A CN202211158047 A CN 202211158047A CN 115904934 A CN115904934 A CN 115904934A
- Authority
- CN
- China
- Prior art keywords
- information
- attribute information
- electronic device
- category
- determining
- 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
- 238000012360 testing method Methods 0.000 title claims abstract description 52
- 238000000034 method Methods 0.000 claims abstract description 52
- 238000001514 detection method Methods 0.000 claims abstract description 38
- 230000006870 function Effects 0.000 claims description 63
- 230000015654 memory Effects 0.000 claims description 29
- 230000004044 response Effects 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 abstract description 23
- 230000008859 change Effects 0.000 abstract description 14
- 238000012795 verification Methods 0.000 description 17
- 238000010586 diagram Methods 0.000 description 12
- 238000001545 Page's trend test Methods 0.000 description 9
- 238000004422 calculation algorithm Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000002159 abnormal effect Effects 0.000 description 4
- 230000003993 interaction Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000011990 functional testing Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 101100115215 Caenorhabditis elegans cul-2 gene Proteins 0.000 description 1
- 101100171060 Caenorhabditis elegans div-1 gene Proteins 0.000 description 1
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 210000000988 bone and bone Anatomy 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 235000014510 cooky Nutrition 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000013499 data model Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 229910052711 selenium Inorganic materials 0.000 description 1
- 239000011669 selenium Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a webpage testing method and a related device. The electronic equipment firstly determines the category of the element to be tested, wherein the category of the element to be tested can comprise a general element and a specified element (also called as a special element), the general element is an element of which the attribute information can not change, and the specified element is an element of which the attribute information can change in the webpage refreshing or dynamic loading process. After determining the category of the element to be tested, the electronic device may acquire, for the specified element, real-time attribute information of the specified element, and acquire positioning information of the specified element based on the real-time attribute information. For a general element, the electronic device may obtain positioning information of the general element based on initial attribute information of the general element. After determining the positioning information of the element, the electronic device may perform a function detection operation on the element and determine whether a functional state of the element is normal.
Description
Technical Field
The present application relates to the field of internet technologies, and in particular, to a web page testing method and a related device.
Background
With the development of internet technology, the scale and complexity of the web application are larger and larger, the updating speed of the application is faster and faster, and the testing workload of the web application is heavier and heavier.
The tester can manually perform a function test on the element in the web interface, and determine whether the element is functioning normally by comparing whether the expected response and the actual response of the web page are the same.
However, as the testing workload of the web application is larger and larger, a lot of time is consumed to perform the web test by manpower, and the testing efficiency is low.
Disclosure of Invention
The application provides a webpage testing method and a related device. The electronic equipment firstly determines the category of the element to be tested, wherein the category of the element to be tested can comprise a general element and a specified element (also called as a special element), the general element is an element of which the attribute information can not change, and the specified element is an element of which the attribute information can change in the webpage refreshing or dynamic loading process. After determining the category of the element to be tested, the electronic device may acquire, for the specified element, real-time attribute information of the specified element, and acquire positioning information of the specified element based on the real-time attribute information. For the general element, the electronic device may acquire positioning information of the general element based on initial attribute information of the general element. After determining the positioning information of the element, the electronic device may perform a function detection operation on the element and determine whether the functional state of the element is normal or abnormal.
In a first aspect, the present application provides a web page testing method, including: acquiring initial attribute information of a first element in a first webpage interface; determining a category of the first element based on preset identification information; acquiring positioning information of the first element based on the category of the first element and the initial attribute information of the first element; and determining the functional state of the first element based on the positioning information of the first element, wherein the functional state comprises normal or abnormal.
In this way, for different classes of elements, the electronic device may detect the functional state of the element in different ways, respectively.
In one possible implementation, the category of the first element includes a specified element; acquiring the positioning information of the first element based on the category of the first element and the initial attribute information of the first element, specifically including: if the first element is a designated element, acquiring real-time attribute information of the first element based on the initial attribute information of the first element; and acquiring the positioning information of the first element based on the real-time attribute information of the first element.
In this way, when the first element is a designated element (also referred to as a special element) whose attribute information may change, the positioning information of the first element may be obtained by obtaining the real-time attribute information of the first element and based on the real-time attribute information.
In one possible implementation, the category of elements also includes general elements. Obtaining the positioning information of the first element based on the category and the initial attribute information of the first element, further comprising: when the first element is determined to be a general element, positioning information of the first element is acquired based on initial attribute information of the first element.
In this way, when the first element is a general element whose attribute information does not change, the positioning information of the first element can be acquired based on the initial attribute information of the first element.
In a possible implementation manner, the initial attribute information of the first element is initially stored or acquired attribute information of the first element; the real-time attribute information of the first element is attribute information of the first element acquired in real time; the attribute information of the first element includes any one or more of: identification, name, link text, category, cascading style sheet information, and extensible markup language path language information.
In a possible implementation manner, the obtaining of the real-time attribute information of the first element based on the initial attribute information of the first element specifically includes: determining first coordinate information of the first element in a first coordinate system based on the initial attribute information of the first element, wherein the second coordinate system is a two-dimensional coordinate system taking a first point in the first webpage interface as an origin; determining second coordinate information of the first element in a second coordinate system of the electronic equipment based on the first coordinate information, wherein the second coordinate system is a two-dimensional coordinate system taking a second point of a display screen of the electronic equipment as an origin; capturing a first element based on second coordinate information, and determining third coordinate information of a first element code segment corresponding to the first element in a second coordinate system; and executing attribute information acquisition operation on the first element code segment based on the third coordinate information to acquire real-time attribute information of the first element.
In one possible implementation, the second coordinate information is the same as the fourth coordinate information. In another possible implementation, the second coordinate information is different from the fourth coordinate information.
In one possible implementation, the category of elements also includes general elements. Determining a category of the first element based on preset identification information, including: acquiring a category identification of the first element based on preset identification information; a category of the first element is determined based on the category identification of the first element.
In a possible implementation manner, before obtaining the category identifier of the first element based on the preset identification information, the method further includes: performing a recognition operation on the first element based on the initial attribute information of the first element; if the identification operation is successful, determining that the class identifier of the first element is the class identifier of the general element, and taking the class identifier of the general element as preset identification information; and if the identification operation fails, determining that the category identification of the first element is the category identification of the designated element, and using the category identification of the designated element as preset identification information.
In this way, all elements to be tested in the web interface can be classified through recognition operation, and the category identifications corresponding to the elements are stored in the database. During subsequent testing of the web page, the electronic device can determine a category of the element based on the category identification of the element.
In one possible implementation, determining the category of the first element based on the category identification of the first element includes: if the category identification of the first element is the same as that of the specified element, determining the category of the first element as the specified element; and if the class identifier of the first element is the same as the class identifier of the general element, determining that the class of the first element is the general element.
In one possible implementation, determining the category of the first element includes: the electronic equipment executes identification operation on the first element based on the initial attribute information of the first element; if the identification operation is successful, determining the category of the first element as a general element; and if the identification operation fails, determining the category of the first element as the specified element.
In this way, the electronic device may also determine a category of the first element based on the recognition operation and determine a functional state of the first element based on the category of the first element and the initial attribute information.
In one possible implementation, the positioning information is: a first object having a first element stored therein; or, the positioning information is fourth coordinate information of the first element in a second coordinate system, and the second coordinate system is a two-dimensional coordinate system with a second point of the display screen of the electronic device as an origin.
In a possible implementation manner, when the positioning information is the first object, the electronic device determines, based on the positioning information, a functional state of the first element, which specifically includes: performing a function detection operation on the first object; outputting first information in response to a function detection operation; when the first information is the same as the second information, determining that the first element is normal in function; determining that the first element is dysfunctional when the first information is different from the second information; and the second information is preset output information corresponding to the function detection operation.
In a possible implementation manner, when the positioning information is fourth coordinate information, determining a functional state of the first element based on the positioning information specifically includes: performing a function detection operation on the area indicated by the fourth coordinate information; outputting third information in response to the function detection operation; when the third information is the same as the fourth information, determining that the first element is normal in function; when the third information is different from the fourth information, determining that the first element is abnormal in function; and the fourth information is preset output information corresponding to the function detection operation.
In one possible implementation, when the identifying operation fails, the method further includes: and if external factors influencing the identification operation exist, outputting an error prompt, wherein the external factors comprise network connection disconnection and/or a first webpage interface operation error.
In this way, the influence of external factors on the recognition operation can be excluded.
In one possible implementation, when there are no external factors affecting the recognition operation, the method further includes: acquiring real-time attribute information of a first element; when the initial attribute information of the first element is the same as the real-time attribute information of the first element, performing any one or more of the following operations: adjusting element latency, adjusting current page window, and adjusting iframe nesting.
In this way, the influence of internal factors on the recognition operation can be eliminated.
In a second aspect, the present application provides an electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors and the one or more memories are configured to store computer program code comprising computer instructions that, when executed by the one or more processors, cause the communication device to perform the method for web page testing in any of the possible implementations of any of the aspects.
In a third aspect, an embodiment of the present application provides a computer storage medium, which includes computer instructions, and when the computer instructions are executed on an electronic device, the communication apparatus is caused to execute a web page testing method in any possible implementation manner of any one of the foregoing aspects.
In a fourth aspect, the present application provides a computer program product, which when run on a computer, causes the computer to execute the web page testing method in any one of the possible implementation manners of the foregoing aspect.
The advantageous effects of the second aspect and the fourth aspect can refer to the advantageous effects of the first aspect, and are not described herein again.
Drawings
Fig. 1 is a schematic interface diagram of a login box 100 according to an embodiment of the present disclosure;
fig. 2A is an interface schematic diagram of a browser interface 200 according to an embodiment of the present disclosure;
fig. 2B is an interface schematic diagram of a web interface 300 according to an embodiment of the present disclosure;
FIG. 2C is an interface diagram of a developer tool interface 400 according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a web page testing method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a process for obtaining real-time attribute information of an element according to an embodiment of the present application;
FIG. 5A is an interface diagram of a browser interface 500 after capturing an element according to an embodiment of the present disclosure;
fig. 5B-5C are schematic diagrams of an interface for acquiring real-time Xpath information of an element according to an embodiment of the present application;
fig. 6 is a schematic flowchart of determining whether an element is a special element through trial operation according to an embodiment of the present application;
fig. 7 is a schematic flowchart of determining whether an element is a special element based on a category identifier of the element according to an embodiment of the present application;
fig. 8 is a schematic functional block diagram of an electronic device 20 according to an embodiment of the present disclosure;
fig. 9 is a schematic diagram of a hardware structure of an electronic device 10 according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and exhaustively described below with reference to the accompanying drawings. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" in the text is only an association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B may mean: three cases of a alone, a and B both, and B alone exist, and in addition, "a plurality" means two or more than two in the description of the embodiments of the present application.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of embodiments of this application, a "plurality" means two or more unless indicated otherwise.
In this embodiment of the present application, a web page may include a web page interface and a web page document, where the web page document may be a hypertext markup language (HTML) document, an extensible markup language (XML) document, a Document Object Model (DOM) document, or other types of documents. One or more elements may be included in the web interface and have corresponding element code segments in the web document. The element code segment in the web document may include attribute information for the element, which may include, but is not limited to, any one or more of the following: identification (id), name (name), link text (LinkText), category (class), cascading Style Sheets (CSS) information, and XML path language (Xpath) information, among others. It should be noted that the element code segment may display attribute information of an element, and in some embodiments, the element code segment may also implicitly include attribute information of an element, for example, an Xpath information of an element may be implied by a position of the element code segment in a web document, and the like.
The Xpath information of the element may be an Xpath path of the element, and based on the Xpath path of the element, the electronic device 10 may find the element code segment of the element from the web document. The Xpath information of an element has a hierarchical structure, and each hierarchy may include a hierarchy label, and optionally, the hierarchy label may further include a hierarchy subscript. Illustratively, taking Xpath information of the element a as HTML/body/div [1]/div [1] as an example, HTML indicates that the web document where the element code segment corresponding to the element a is located is an HTML document, and body indicates the main part of the HTML document. The HTML document can be divided into different layers (also called blocks) by the container tag div. According to the Xpath information of the element A, the first hierarchical label of the Xpath of the element A is div, and the subscript is 1; the second hierarchical tag is div, with an index of 1, indicating that the element code segment for element a is located in the first div under the first div of the body portion of the HTML document.
Some of the terms used in the examples of the present application are described below.
Hypertext markup language (HTML) is an application under a standard universal markup language, and is also a specification, a standard. HTML is a grammatical rule used to mark how web pages (web) are exposed and other properties. "hypertext" refers to pictures, links, and even non-textual elements of music, programs, and the like. HTML marks how the various elements in a web page are displayed by markup symbols. The structure of the hypertext markup language includes a "head" section, which provides information about a web page, and a "body" section, which provides specific contents of the web page, such as attribute information of elements in the web page, and the like.
Extensible markup language (XML), which is a subset of standard generalized markup languages, can be used to mark data, define data types, and is a source language that allows users to define their own markup languages. XML has the advantages of good expandability, separation of content and form, following strict grammar requirement, good value-keeping performance and the like.
The XML path language (XPath) is a language used to locate a portion of an XML document. Xpath is based on the tree structure of XML, providing the ability to find nodes in the data structure tree.
An Application Programming Interface (API), also called API, is a convention for linking different components of a software system.
The Document Object Model (DOM) is an API that is formulated by the world wide web consortium (W3C) organization for handling HTML and XML. The process of converting an HTML document or an XML document into a DOM tree is called parsing (parse). Taking an HTML document as an example, after the HTML document is parsed, the HTML document is converted into a DOM document, which is also called a DOM tree, the DOM document is used as a tree structure, and each node of the tree can represent an HTML tag or a text item in the tag. The DOM tree structure accurately describes the interrelationship between the tags in the HTML document. The DOM tree not only describes the structure of the document, but also defines the behavior of the node object, and the nodes and the content of the DOM tree can be conveniently accessed, modified, added and deleted by using the method and the attribute of the object. The processing of the HTML document can be achieved by operating on the DOM tree.
Cascading Style Sheets (CSSs) is a computer language used to represent the style of documents such as HTML or XML. The CSS can not only statically modify the web page, but also dynamically format elements of the web page in coordination with various scripting languages. The CSS can accurately control the typesetting of element positions in the webpage in a pixel level and has the capability of editing webpage objects and model styles.
A developer tool, which in the present embodiment may be referred to as a browser developer tool, is a tool used by professional web application and website developers. The developer tool can help the developer to lay out the web page interface, for example, modify the HTML and CSS of the web page, help the front-end engineer to debug scripts (for example, javaScript and jQuery) and the like better, and can also use the tool to view the web page loading process, obtain the web page request (this process is also called a capture packet), and the like.
The HyperText transfer protocol (HTTP) is a network protocol that is most widely used on the internet, and is a rule that must be followed to browse a web page, view an online video, play online music, and the like. The interaction of requests and responses between the browser and the server must be in accordance with the format and rules specified by the HTTP protocol. Under the HTTP protocol, a browser (web client) may send a web document request to a web server, in response to which the server will send the requested document back to the browser.
In the embodiment of the present application, the web page test mainly refers to performing functionality test on elements in a web page interface. That is, whether the function of the element in the web interface is correct is determined by determining whether the function actually executed by the web page when the element receives a specific operation (e.g., clicking, inputting, double-clicking, long-pressing, etc.) is the same as a preset function. The web page test may include the following three steps:
(1) And (6) element positioning.
The element positioning refers to the electronic device 10 recognizing an element (i.e., a test target) on the web interface and obtaining a positioning result of the element. It should be noted that, in the embodiment of the present application, the positioning result may also be referred to as positioning information.
In some embodiments, the result of the location of the element may be coordinate information of the element.
In other embodiments, the positioning result of the element may also be a storage object (WebElement) storing the element, that is, the electronic device 10 may assign the element to a storage object and use the storage object as the positioning result of the element.
(2) A function detection operation is performed on the element.
After obtaining the positioning result of the element, the electronic device 10 may perform a function detection operation on the element by simulating a keyboard or mouse operation based on the positioning result of the element. The function detection operation may include, but is not limited to, any one or more of the following: mouse clicks, drags, enters text, slides, and the like.
When the acquired positioning result of the element includes the coordinate information of the element, the electronic device 10 may perform the function detection operation with respect to the area indicated by the coordinate information of the element.
When the positioning result of the element includes the storage object, the electronic device 10 may implement a function detection operation on the element by an operation on the storage object.
(3) And determining the functional state of the element, namely judging whether the element is normal in function.
After performing the function detection operation on the element, the electronic device 10 may determine whether the function of the element is normal based on the actual response and the expected response of the web page. Where the response (e.g., actual response or expected response) of the web page may include, but is not limited to, any one or more of: changes in window title, jumps in page URL, updates to Web page controls, and the like.
When the actual response of the web page is the same as the expected response, the electronic device 10 may determine that the element is functioning properly.
When the actual response of the web page differs from the expected response, the electronic device 10 may determine that the element is malfunctioning.
The core of the web page test is element positioning.
The following describes a web page testing method based on image recognition provided by the embodiment of the application.
Prior to web page testing, electronic device 10 may perform elemental image data collection and model training, building an image feature database, which may include one or more image features of one or more elements and their image feature-to-element correspondence. In the process of testing the web page, the electronic device 10 may respectively capture screenshots of areas where elements in the web page interface are located, perform image recognition on the screenshots of the elements based on an image recognition algorithm and an image feature database, and determine an element corresponding to the screenshot of the element. After identifying an element in the screenshot of the element, electronic device 10 may determine a location of the element based on an area where the screenshot of the element was captured, perform a function detection operation on the element, and determine whether the function of the element is normal.
The above-mentioned web page testing method based on image recognition is described by taking the login box 100 shown in fig. 1 as an example.
As shown in FIG. 1, login box 100 includes a number of elements, a username entry box 101, a password entry box 102, and a login control 103.
In the test process, the electronic device 10 may store the screenshots of the areas where the different elements in the Login box 100 are located, for example, the screenshot of the area 101a where the user name input box 101 is located is stored as a picture user.
After obtaining the screenshot of the element in the Login box 100, the electronic device 10 may respectively match the picture user.png, the picture passage.png, and the picture Login _ button.png with the image features of the elements in the image feature database stored in the electronic device 10 by using an image recognition algorithm, and determine that the element in the picture user.png is the user name input box 101, the element in the picture passage.png is the password input box 102, and the element in the picture Login _ button.png is the Login control 103. After identifying the elements in each screenshot, electronic device 10 may determine that the location of username input box 101 in the web interface is region 101a, the location of password input box 102 in the web interface is region 102a, and the location of login control 103 in the web interface is region 103a.
Thereafter, the electronic device 10 may perform an input operation on the user name input box 101 by an input operation on the area 101a, and determine whether the function of the user name input box 101 is normal according to whether the actual response of the web page is consistent with the expected response. Similarly, the electronic device 10 may also test whether the password input box 102 and the login control 103 are functioning properly.
By adopting the webpage testing method based on image recognition, the element in the webpage interface can be positioned based on image recognition, and then the element is executed with function detection operation, and whether the function of the element is normal or not is judged. However, there are often controls with the same or similar styles in the web page interface, and in this case, the adoption of the method can easily cause element recognition errors, which can reduce the positioning accuracy, thereby reducing the test success rate. In addition, because the image scenes suitable for different image recognition algorithms are different, and the display modes of different web interfaces are also various, the web page testing method based on the image recognition algorithms is not wide in application range, and a large amount of debugging and verification work of the image algorithms is required to be performed by special personnel before testing, so that the workload is large, and the efficiency is low.
The embodiment of the application further provides a webpage testing method based on the attribute information of the elements.
The electronic device 10 may search an element code segment matching the attribute information from the web document based on any one of the attribute information of the element, acquire a positioning result (coordinate information or a storage object) of the element according to a correspondence between the element code segment and the element, perform a function detection operation on the element based on the positioning result of the element, and determine whether the function of the element is normal.
In addition, in some embodiments, the electronic device 10 may determine a plurality of element code segments having attribute information of an element according to one of the items of attribute information (e.g., class) of the element. In this case, the electronic device 10 may perform element positioning using the other attribute information of the element, or perform element positioning in combination with the other attribute information of the element, and so on.
How to perform web page testing based on attribute information of elements is described below with reference to fig. 2A to 2C.
Illustratively, fig. 2A shows an interface schematic diagram of a browser interface 200 provided in an embodiment of the present application.
As shown in FIG. 2A, the electronic device 10 is displayed with a browser interface 200, which browser interface 200 may include a web site bar 201, a web page interface 300, and a developer tools interface 400. The website bar 201 may be used to display a website corresponding to the web interface 300. One or more element code segments may be displayed in developer tool interface 400, which are element code segments in a web document corresponding to web interface 300. The developer tool interface 300 may be displayed on the right side of the web interface 300 or may be displayed in other locations.
Fig. 2B and 2C show an interface schematic of the web page interface 300 and the developer tool interface 400, respectively.
As shown in FIG. 2B, web interface 300 may include one or more elements, such as a picture search control 301, a search bar 302, and a search control 303.
As shown in fig. 2C, developer tool interface 400 may include a display area 401, a control display area 402, and a slider 403. The control display area 402 may include one or more controls, such as an element capture control 411, a device toggle control 412, a more options control 417, a settings control 418, a customization and control 419, and a close control 420, and the control display area 402 may also include one or more options, such as an element (elements) option 413, a console (console) option 414, a source code (resources) option 415, and a network (network) option 416. Optionally, developer tool interface 400 may also include one or more other options 430 (e.g., style option, calculated option, event listener option, DOM breakpoint option, property option, and accessibility options, etc.) and CSS display area 440.
As shown in fig. 2C, the one or more element code segments in display area 401 may include element code segment 404, and so on. The element code segment 404 is an element code segment corresponding to the search bar 302 in the web interface 300.
Among the above-mentioned one or more controls, the element capture control 411 may be used to trigger the electronic device 10 to enter an element capture state, in which the electronic device 10 may capture an element in the web interface by simulating a mouse operation, taking the search bar 302 as an example, when the search bar 302 is captured, the electronic device 10 may determine the element code segment 404 in the web document based on a corresponding relationship between the search bar 302 and the element code segment 404, and change a background color of an area where the element code segment 404 is located. As shown in fig. 2C, in the display area 401, an element corresponding to the element code segment 404 is captured, and the background display color of the element code segment 404 is different from the background display color of the other element code segments.
More options control 417 may be used to trigger electronic device 10 to display more options such as performance (performance) options, memory (memory) options, application (application) options, and security (security) options, among others.
The settings control 418 may be used to trigger the electronic device 10 to display a settings interface for the developer tool in which one or more of the developer tool's interface appearance, workspace, library code, etc. may be set.
Custom and control controls 419 may be used to perform control-class operations, such as adjusting the positional relationship of the developer tool interface with the web interface, searching, executing commands, or opening files, among others.
The close control 420 may be used to trigger the electronic device 10 to close the developer tool and to cancel the display of the developer tool interface.
In one or more of the options described above, the element option may be used to trigger the electronic device 10 to display some or all of the element code segments in the web document corresponding to the web interface in the display area 401. Element options 413 may be used to view or modify the element code segments in the HTML document (including attribute information for the element), CSS information for the element, listening events, breakpoints, etc. In some embodiments, the CSS information of the element may be modified, and the display style of the element in the web interface may be determined based on the modified CSS information.
The console option 414 may be used to trigger the electronic device 10 to display a console interface in the display area 401 where the electronic device 10 may execute the one-time code, view JavaScript objects, view debug log information, or exception information. In some embodiments, the console interface may also be used as a Javascript API view.
The source code option 415 can be used to view the HTML file source code, javaScript source code, CSS source code of the page, and most importantly, the JavaScript source code can be debugged, a breakpoint can be added to the JS code, and so on.
The network options 416 may be used to trigger the electronic device 10 to display a record of requested loading information for the current web page, a record of various requested resource information (including status, resource type, size, time spent, etc.), and so forth.
The performance options may be used to trigger the performance of the electronic device 10 to display the current web page.
The memory option may be used to trigger the electronic device 10 to display the memory consumption of the current web page.
The application option may be used to trigger the electronic device 10 to display a record of all resource information loaded by the website, including stored data (Local Storage, session Storage, indexedDB, web SQL, cookies), cached data, and the like.
The security option may be used to trigger the electronic device 10 to determine whether the current web page is secure.
Taking the search bar 302 shown in fig. 2B as an example, according to the display area 401 shown in fig. 2C, the element code segment 404 corresponding to the search bar 302 may include the following contents: "< input id =" kw "name =" wd "class =" s _ ipt "value =" maxlength = "255" autocomplete = "off" >. Element code segment 404 includes the following attribute information for search bar 302: id is "kw", name is "wd", and class is "s _ ipt". Accordingly, the electronic device 10 may determine the element code segment 404 corresponding to the search bar 202 based on one or more items of attribute information (e.g., id or Xpath information, etc.) of the search bar 302, and obtain the positioning result of the search bar 302 based on the corresponding relationship between the element code segment 404 and the search bar 302. Thereafter, the electronic device 10 may perform a function detection operation on the search bar 302 based on the positioning result of the search bar 302 and determine whether the function of the search bar 302 is normal.
In some embodiments, the electronic device 10 may also obtain, by using an automated testing tool (e.g., RFT, QTP, selenium, etc.), a positioning result of the element based on the attribute information of the element, and perform a function detection operation on the element based on the positioning result of the element to determine whether the function of the element is normal.
By adopting the above-mentioned web page testing method, the electronic device 10 can obtain the positioning result of the element based on the attribute information of the element stored in the electronic device 10, thereby realizing the functional test of the element. However, since the electronic device 10 stores the initial attribute information of the element, and the attribute information of the element may change with the conditions of web page refresh, web page dynamic loading, and the like, the real-time attribute information of the same element may be different from the initial attribute information, in this case, the electronic device 10 may not be able to locate the element based on the initial attribute information of the element, which affects the efficiency of web page testing.
It should be noted that the initial attribute information of an element is the attribute information of the element initially stored or collected by the electronic device 10. The real-time attribute information of an element is attribute information of the element acquired by the electronic device 10 in real time. Taking the first element as an example, the initial attribute information of the first element may be the attribute information of the first element stored by the electronic device 10 before the web page test, or may be the attribute information of the first element collected and stored after the web page test is started. The real-time attribute information of the first element may be attribute information of the first element at the current time, which is obtained in real time by the electronic device 10 in the web page test process.
The embodiment of the application provides a webpage testing method. The electronic device 10 may first determine a category of an element to be tested, where the category of the element to be tested may include a general element and a special element (the special element may also be referred to as a specific element in this embodiment), the general element is an element whose attribute information does not change, and the special element is an element whose attribute information may change during a webpage refresh or dynamic loading process. After determining the category of the element to be tested, the electronic device 10 may obtain real-time attribute information of the special element for the special element, and obtain a positioning result of the special element based on the real-time attribute information. For a general element, the electronic device 10 may obtain a positioning result of the general element based on the initial attribute information of the general element. After determining the positioning result of the element, the electronic device 10 may perform a function detection operation on the element and determine whether the function of the element is normal.
The following describes a specific process of the web page testing method provided in the embodiment of the present application.
As shown in fig. 3, taking a first element in a web interface (e.g., a first web interface, etc.) as an element to be tested as an example, a specific process of the web page testing method may include the following steps:
s301, the electronic device 10 obtains initial attribute information of the first element.
The electronic device 10 may retrieve initial attribute information for the first element from the database.
The electronic device 10 may collect in advance attribute information and control information of one or more elements (including the first element) in the web interface, and store the attribute information and the control information in the database. For example, the electronic device 10 may gather initial attribute information for the one or more elements in the web interface based on a web document (e.g., an HTML document). For another example, the electronic device 10 may also traverse all elements in the web interface based on the web interface, find an element code segment corresponding to each element, and obtain initial attribute information of the element based on the element code segment, and so on.
In other embodiments, the electronic device 10 may also obtain attribute information and control information of one or more elements in a web interface imported by the user through other electronic devices and establish the database.
The databases may include an attribute database and a control database.
The attribute database is configured to store attribute information (initial attribute information and/or real-time attribute information) of the element, and the attribute information of the element may refer to the relevant description in the foregoing embodiment, which is not described herein again. It should be noted that the attribute database may include attribute information of all elements in the web interface of the tested web page, and in some embodiments, for example, when only a part of elements in the web interface need to be tested, the attribute database may include only attribute information of a part of elements in the web interface.
Illustratively, table 1 shows the content composition of a database of attributes.
TABLE 1 Attribute database
Element name | id | name | Xpath |
Element A | k1 | wd1 | /html/body/div[1] |
Element B | k2 | wd2 | /html/body/div[1]/div[1] |
As shown in Table 1, the attribute database may include initial attribute information for one or more elements. The one or more elements may include element a and element B. The initial attribute information may include any one or more of attribute information, such as id, name, and Xpath information. As can be seen from table 1, the initial attribute information of element a is as follows: id is k1, name is wd1, and Xpath information is html/body/div [1]. The initial attribute information of element B is as follows: id is k2, name is wd2, and XPath information is html/body/div 1. In some embodiments, the element names may not be included in the attribute database.
It should be understood that the attribute database shown in table 1 is only an example, and in the embodiment of the present application, the attribute information base may include more, fewer, or other different elements, and may also include more, fewer, or different attribute information, and the present application is not limited herein.
The control database may be used to store control information for the elements, which may include: one or more operations corresponding to the element, and expected output information corresponding to the one or more operations, respectively (i.e., expected information output by the electronic device 10 in response to the operation). The expected output information of the operation may include any one or more of: changes in window title, jumps in page URL, updates to Web page controls, and the like.
Illustratively, table 2 shows the content composition of a control database.
TABLE 2 control database
Element name | Operation of | Expected output information |
Element A | Click on | Information 1 |
Element B | Input the method | Information 2 |
As shown in table 2, the control database may include control information for one or more elements. The one or more elements may include element a and element B. The control information of an element may include an operation and expected output information after the operation. As can be seen from table 2, the control information of element a is as follows: after the electronic device 10 receives the click operation for the element a, the expected output information is information 1; after receiving the input operation of the pair of elements B, the electronic device 10 expects the output information to be information 2. In some embodiments, the attribute database may not include the element name, but rather use the id or serial number of the element as the identification of the element.
It should be understood that the control database shown in table 2 is only an example, in the embodiment of the present application, the control database may further include more or less elements, and the control information of each element may include more, less or other different operations and corresponding expected output information, which is not limited herein.
In other embodiments, the electronic device 10 may also obtain the initial attribute information of the first element in the process of acquiring the element, for example, the electronic device 10 may sequentially obtain the initial attribute information of one or more elements (including the first element) from the web document according to a certain order.
S302, the electronic device 10 determines whether the first element is a special element.
The electronic device 10 may determine whether the first element is a special element by performing a trial operation on the first element, and specific manner may refer to the following description in the embodiment shown in fig. 6.
In other embodiments, the electronic device 10 may also determine the category of the first element based on preset identification information, where the preset identification information is information stored in a preset location (e.g., a memory of the electronic device 10, or another storage medium external to the electronic device 10, etc.) for identifying the category of the element. The preset identification information may include a category identifier of the first element. For example, the electronic device 10 may determine whether the first element is a special element based on the category identifier of the first element stored in the electronic device 10, and the specific determination manner may refer to the content in the embodiment shown in fig. 7 described below, which is not detailed herein at this time. It should be noted that the category identifier is an identifier for marking a category of an element (i.e., whether the element is a special element). The specific content of the category identification can refer to the following description in the embodiment shown in fig. 6 or fig. 7.
S303, the electronic device 10 obtains real-time attribute information of the first element.
The electronic device 10 may obtain real-time attribute information of the first element based on the initial attribute information of the first element. The real-time attribute information of the first element is attribute information of the first element at the current moment, which is acquired by the electronic device 10 in real time in the process of testing the web page. In some embodiments, when the web page test is after the state of web page refresh or dynamic loading is finished, the real-time attribute information of the first element may also refer to the attribute information of the first element after the state of web page refresh or dynamic loading is finished.
The specific manner of acquiring the real-time attribute information of the first element by the electronic device 10 may refer to the following description in the embodiment shown in fig. 4, which will not be described in detail here.
S304, the electronic device 10 obtains the positioning result of the first element based on the real-time attribute information of the first element.
After determining that the first element is a special element, the electronic device 10 may obtain a positioning result of the first element based on the real-time attribute information of the first element. The specific positioning manner can also refer to the related description in the embodiment shown in fig. 2A to fig. 2C. The positioning result may be coordinate information (e.g., fourth coordinate information in the second coordinate system) or a storage object (e.g., the first object). It should be noted that the second coordinate system may be a coordinate system with a second point on the display screen of the electronic device 10 (e.g., the center, the lower left corner, the lower right corner, etc.) as the origin.
After acquiring the positioning result of the first element, the electronic device 10 may perform steps S306 to S307 described below.
S305, the electronic device 10 obtains the positioning result of the first element based on the initial attribute information of the first element.
When the first element is a general element, the electronic device 10 may acquire a positioning result of the first element based on the initial attribute information of the first element. The specific manner of obtaining the positioning result may refer to the related description in the embodiments shown in fig. 2A to fig. 2C. For the positioning result of the first element, reference may be made to the related description in step S304, and details are not repeated here.
After acquiring the positioning result of the first element, the electronic device 10 may perform steps S306 to S307 described below.
S306, the electronic device 10 executes a function detection operation on the first element based on the positioning result of the first element.
The electronic device 10 may perform the function detection operation on the first element by simulating a keyboard and mouse operation. The function detection operation may include, but is not limited to, any one or more of the following: mouse clicks, drags, enters text, slides, and the like. The operation form of the function detection operation of the first element may include one or more operations corresponding to the first element in the control database.
S307, the electronic device 10 determines whether the function of the first element is normal or abnormal.
After performing the function detection operation on the first element, the electronic device 10 may determine actual output information (which may also be referred to as first information or third information) of the electronic device 10. The actual output information or the expected output information of the electronic device 10 may include, but is not limited to, any one or more of the following: changes in window title, jumps in page URL, updates to Web page controls, and the like.
The electronic device 10 may also retrieve from the database the expected output information (which may also be referred to as the second information or the fourth information) of the first element after receiving the function detection operation. Specifically, the electronic device 10 may obtain an operation corresponding to the first element from the control database as the function detection operation, and the electronic device 10 may further obtain a result corresponding to the operation from the control database as the expected output information. For example, taking the first element as element a in table 2 as an example, the expected output information of the electronic device 10 after receiving the click operation (or the simulated click operation) for the first element is result 1.
After determining the actual result and the expected output information for the web page, the electronic device 10 may determine whether the first element is functioning properly based on the actual result and the expected output information for the web page.
When the actual result of the web page is the same as the expected output information, the electronic device 10 may determine that the element is functioning properly.
When the actual result of the web page is different from the expected output information, the electronic device 10 may determine that the element is malfunctioning.
In one possible implementation manner, as shown in fig. 4, a specific process of the electronic device 10 acquiring real-time attribute information of the first element based on the initial attribute information of the first element may include the following steps:
s401, the electronic device 10 starts a developer tool.
The electronic device 10 may open the developer tool via analog keyboard input (e.g., analog input F12 key). After launching the developer tool, electronic device 10 may display the developer tool interface on the right side of the web interface (and also below, to the left of, or elsewhere on the web interface). In the developer tool interface, some or all of the element code segments in the web document may be displayed. For example, after launching the developer tool, the browser interface may be browser interface 200 shown in FIG. 2A, the web interface may be web interface 300 shown in FIGS. 2A and 2B, and the developer tool interface may be developer tool interface 400 shown in FIGS. 2A and 2C.
S402, the electronic device 10 determines coordinate information 1 of the first element in the web interface based on the initial attribute information of the first element.
In some embodiments, electronic device 10 may determine coordinate information 1 (i.e., the first coordinate information in the first coordinate system) by entering a coordinate acquisition instruction in the console interface. The first coordinate system may be a two-dimensional coordinate system established by using a first point in the web interface (e.g., a center, an upper left corner, a lower right corner, etc. of the web interface) as an origin.
The coordinate acquisition instruction may include any one or more items of attribute information of the first element. For example, the coordinate obtaining instruction of the first element may be "document, grtElementById ('tab-tool'), getBoundingClientRect ()". It is understood that this is only an example, and in other embodiments, other attribute information (for example, xpath information, etc.) of the first element may also be used, or other functions may also be used to determine the coordinate information 1, and the application is not limited herein.
It should be noted that the coordinate information 1 may indicate an area, for example, an area where the first element is located, and in some embodiments, the coordinate information 1 may also indicate a point coordinate, for example, a point in the area where the first element is located.
S403, the electronic device 10 determines coordinate information 2 of the first element on the display screen based on the coordinate information 1.
In the embodiment of the present application, the coordinate information 1 indicates the position of the first element in the web interface. Therefore, before the electronic device 10 simulates mouse clicking, the coordinate information 2 of the first element on the display screen of the electronic device 10 (i.e., the second coordinate information in the second coordinate system) needs to be determined based on the coordinate information 1. The second coordinate system may be a two-dimensional coordinate system established with a second point on the display screen of the electronic device 10 as an origin. The coordinate information 2 may indicate an area, for example, an area on the display screen where the first element is located, and in some embodiments, the coordinate information 2 may also indicate a point coordinate, for example, a point in the area on the display screen where the first element is located.
In some embodiments, when the positioning result of the first element in the embodiment shown in fig. 3 is coordinate information (i.e., fourth coordinate information), the fourth coordinate information may be the same as the second coordinate information. In other embodiments, the fourth coordinate information may be different from the second coordinate information.
The electronic device 10 may determine the coordinate information 2 of the first element on the display screen in either of the following two ways.
The first method is as follows:
1. the electronic device 10 adjusts the window in which the web interface is located to the maximized display state.
2. The electronic device 10 determines the coordinate information 1 as the coordinate information 2.
The second method comprises the following steps:
1. the electronic device 10 determines the position of the window in which the web interface is located in the display screen.
2. The electronic device 10 determines the size of the window in which the web interface is located.
3. The electronic device 10 determines coordinate information 2 of the first element on the display screen based on the window size, the window position, and the coordinate information 1 of the web interface.
It should be noted that there is no timing relationship in the execution order between step S403 and step S404 described below.
In some embodiments, if the subsequent electronic device 10 performs the function detection operation on the first element based on the coordinate information of the first element, the electronic device 10 may also use the coordinate information 2 as the positioning result of the first element.
It should be noted that, since most of the current testing tools acquire the storage object storing the first element based on the attribute information of the first element, and test the function of the first element by operating the storage object, in this embodiment of the present application, after acquiring the coordinate information 2 of the first element, it is preferable to further acquire the real-time attribute information of the first element, that is, to execute the following steps S404 and the following steps.
S404, the electronic device 10 starts an element capture tool.
The electronic device 10 may launch the element capture tool by simulating a mouse click or simulating a keyboard entry.
The element capture tool may be used to capture an element in the web interface, i.e., after launching the element capture tool, the electronic device 10 may capture the first element by mouse-clicking (or simulating mouse-clicking) any element in the web interface (here, the first element is taken as an example). After the first element is captured, electronic device 10 may change the background display color of the first element code segment in the developer tool interface. The first element code segment is an element code segment corresponding to the first element.
The element capture tool may be an element capture tool in a developer tool (e.g., element capture tool 411 shown in FIG. 2A). In some embodiments, the element capture tool may also be a tool in other application software that may be used to perform the element capture functions described above.
S405, the electronic device 10 captures a first element based on the coordinate information 2.
After obtaining the coordinate information 2 of the first element on the display screen, the electronic device 10 may simulate a mouse click, click any point in the area indicated by the coordinate information 2 on the display screen, and capture the first element with an element capture tool.
After capturing the first element, electronic device 10 may display a capture mark in an area where the first element code segment corresponding to the first element is located. The electronic device 10 display capture identification may include any one or more of: changing the background display color of the area where the first element code segment is located, displaying a mark (e.g., a star mark) in the area where the first element code segment is located, highlighting the first element code segment, and so on.
Optionally, after the first element is captured, a background display color of an area of the developer tool interface where the first element code segment corresponding to the first element is located may be changed.
For example, fig. 5A shows an interface schematic diagram after the electronic device 10 captures an element in the web interface.
As shown in FIG. 5A, the electronic device 10 may display a browser interface 500, which browser interface 500 may include a web site bar 510, a web page interface 520, and a developer tools interface 530. The website bar 510 may be used to display a website corresponding to the web interface 520. One or more elements may be included in the web interface, including account entry box 521. An element code segment, such as element code segment 531, of one or more elements may be displayed in the developer tools interface 530, where the element corresponding to the element code segment 531 is the account entry box 521. For details of the developer tool interface 530, reference may be made to the developer tool interface 400 shown in fig. 2C, which is not described herein again.
When the account entry box 521 is the first element captured by the electronic device 10, the electronic device 10 may capture the account entry box 521 using an element-simulated mouse to click on a display area 521a of the account entry box 521 in the display screen. After the electronic device 10 captures the account entry box 521, the electronic device 10 changes the background display color of the area of the developer tool interface 530 where the element code segment 531 is located. As shown in fig. 5A, the background display color of the area where the element code segment 531 is located is different from the background display color of the area where the other element code segments are located.
S406, the electronic device 10 determines the coordinate information 3 of the first element code segment corresponding to the first element on the display screen.
Since the background display color of the area where the first element code segment corresponding to the captured first element is located in the developer tool interface is different from the background display color of the area where the other element code segments are located, the electronic device 10 may determine, by scanning the display areas of the element code segments in the developer tool interface, that the coordinate information of the area on the display screen where the areas with different background display colors are located is the coordinate information 3, that is, determine the coordinate information 3 of the area where the first element code segment is located (i.e., the third coordinate information in the second coordinate system).
The area indicated by the coordinate information 3 may be an area of the first element code segment on the display screen of the electronic device 10, or may be a point coordinate in the area of the first element code segment on the display screen of the electronic device 10.
S407, the electronic device 10 executes an attribute information obtaining operation on the first element code segment based on the coordinate information 3, and obtains real-time attribute information of the first element.
The electronic device 10 may perform an attribute information acquisition operation on the first element code segment by simulating a keyboard and mouse operation based on the coordinate information 3, acquire the attribute information of the first element, and determine the newly acquired attribute information of the first element as the real-time attribute information of the first element.
It should be noted that the real-time attribute information of the first element is the attribute information of the first element acquired by the electronic device 10 based on the first element code segment after the web page is in a stable state (for example, the web page is completely loaded or the web page is completely refreshed). In the case that the state of the web page is stable, the attribute information of the first element does not change any more, so the first element can be located based on the newly acquired real-time attribute information of the first element. The initial attribute information of the first element is obtained based on the web page document before the web page test, or the electronic device 10 obtains from a database, where the initial attribute information is generally obtained before the web page is loaded. Therefore, after the webpage is loaded or refreshed, the real-time attribute information of the first element may be different from the initial information of the first element.
How the electronic device 10 acquires the real-time attribute information of the first element by the attribute information acquisition operation for the first element code segment is described below.
Taking the example that the first element code segment is "input id =" kw "name =" wd "class =" s _ ipt "value =" maxlength = "255" autocomplete = "off", the electronic device 10 may acquire one or more of the attribute information such as id, name, and class in the first element code segment by simulating a keyboard and mouse operation.
The electronic device 10 may also obtain attribute information such as Xpath information, CSS information, and the like of the first element by simulating a keyboard and mouse operation on the first element code segment. Illustratively, after the electronic device 10 acquires the coordinate information 3 of the first element code segment, the electronic device 10 may acquire Xpath information of the first element code segment in the following manner as shown in fig. 5B to 5C.
The electronic device 10 may simulate a right mouse click operation in an area where the element code segment 531 is located based on the coordinate information 3 corresponding to the element code segment 531, and in response to the right mouse click operation, as shown in fig. 5B, the electronic device 10 may display an operation menu 540 as shown in fig. 5B in the developer tool interface 530.
As shown in fig. 5B, the operation menu 540 may include one or more operation options for triggering the electronic device 10 to perform an operation corresponding to the operation option on an element corresponding to the element code segment 531. For example, the one or more operational options may include an add property option, an edit in HTML option, a delete element option, a copy option 541, a hide element option, a force state option, an break in option, a expand in recursive fashion option, a collapse sub-item option, a capture node screenshot option, a scroll to view option, a focus option, and a store as global variable option.
Electronic device 10 may move the mouse to the area where copy option 541 is located by simulating mouse movement. After electronic device 10 simulates a mouse movement to the area where copy option 541 is located, electronic device 10 may display a copy menu 550, as shown in FIG. 5C, in developer tools interface 530.
As shown in fig. 5C, the copy menu 550 may include one or more copy operation options for triggering the operation of the electronic device 10 for copying, cutting, pasting, or copying information corresponding to the copy operation option of the first element (the account input box 521 corresponding to the element code segment 531). For example, the one or more copy operation options may include: a cut element option, a copy element option, a paste element option, a copy outterhtml option, a copy selector option, a copy JS path option, a copy style option, a copy Xpath option 551, and a copy complete Xpath option 552.
The electronic device 10 may simulate a mouse click operation, click the area where the copy Xpath option 551 or the copy complete Xpath option 552 is located, and obtain the real-time Xpath information of the first element.
It should be noted that, since the operation menu 540 and the copy menu 550 displayed by the electronic device 10 may be predetermined or preset, the electronic device 10 may determine the area where the copy option 541 is located based on the display position of the operation menu 540 and the arrangement order of the operation options in the operation menu 540. Similarly, the area where the Xpath option is copied and the area where the complete Xpath option is copied can also be determined. This is not described in detail in the present application.
S408, the electronic device 10 verifies the real-time attribute information of the first element.
Step S408 is an optional step.
The electronic device 10 may determine whether the verification was successful by simulating whether the operation on the first element was successful. That is, the electronic device 10 may locate the first element based on the real-time attribute information of the first element, perform an operation on the first element, and determine whether the operation is successful. The success or failure of the operation may be determined based on control information of the first element stored in the database. When the operation is successful, the electronic device 10 determines that the verification is successful and that the real-time attribute information of the first element is correct. When the operation fails, the electronic device 10 determines that the verification fails, and determines that the real-time attribute information of the first element is erroneous.
In some embodiments, when the obtained real-time attribute information of the first element includes the real-time Xpath information of the first element, the electronic device 10 may further check the real-time Xpath information of the first element in the following manner.
The specific process for checking the real-time Xpath information of the first element may include the following steps:
1. the electronic device 10 obtains the initial Xpath information of the first element from the database.
2. The electronic device 10 determines a verification result based on the initial Xpath information of the first element and the real-time attribute Xpath information of the first element.
It should be noted that, although the XPath information of the same element in the web interface may change before and after the web page is loaded or refreshed, the hierarchical structure of the XPath information of the element is stable, that is, before and after the web page is loaded or refreshed, the number of the levels of the XPath information of the same element and the level label of each layer are determined, and the change is only the subscript of each level label.
Therefore, when checking the real-time Xpath of the first element, the initial Xpath information of the first element and the real-time Xpath information of the first element can be subjected to fuzzy matching. And if the matching is successful, the verification is successful. If the matching fails, the verification fails. For example, when the number of levels of the initial Xpath information of the first element is the same as that of the real-time Xpath information, and each level label is also the same, it may be determined that the verification is successful, otherwise, the verification fails. The verification method is only an example, and in some embodiments, other fuzzy matching algorithms may also be used, which is not limited herein.
If the verification is successful, the electronic device 10 determines that the real-time attribute information of the first element is correct.
If the verification fails, the electronic device 10 determines that the real-time attribute information of the first element is incorrect, closes the developer tool, and re-executes step S401 and the subsequent steps.
S409, the electronic device 10 stores the real-time attribute information of the first element.
Step S409 is an optional step.
After determining the real-time attribute information of the first element, the electronic device 10 may store the real-time attribute information of the first element, e.g., store the real-time attribute information of the first element in a database.
Further illustratively, table 3 shows a content composition of attribute information of a first element in an attribute database.
TABLE 3 Attribute information for the first element in the Attribute database
As shown in table 3, the attribute information of the first element in the attribute database may include initial attribute information of the first element and real-time attribute information of the first element. The initial attribute information may include any one or more items of the attribute information described in the above embodiments, and the real-time attribute information may also include any one or more items of the attribute information in the above embodiments. For example, the initial attribute information of the first element may include id and Xpath information of the first element, and the real-time attribute information of the first element may include real-time Xpath information of the first element. As can be seen from table 3, the initial attribute information of the first element is as follows: id is h1, and Xpath information is/html/body/div 2. The real-time attribute information of the first element is as follows: the Xpath information is/html/body/div 2/div 3.
It should be understood that the attribute information of the first element shown in table 3 is only an example, and in this embodiment, the attribute information of the first element stored by the electronic device 10 may include more, less or other different contents, and this application is not limited herein.
In this way, no matter whether the attribute information of the element in the web interface changes, the electronic device 10 may obtain the real-time attribute information of the element by using the method in the embodiment shown in fig. 4, determine the location of the element based on the real-time attribute information of the element in the subsequent process of performing the function test on the element, perform the function detection operation on the element, and check whether the function of the element is normal.
In some embodiments, electronic device 10 may determine whether an element is a special element by performing a trial operation on the element. In the embodiment of the present application, the trial operation may also be referred to as an identification operation.
As shown in fig. 6, taking the first element as an example, the specific process of the electronic device 10 determining whether the first element is a special element may include the following steps:
s601, the electronic device 10 performs a trial operation on the first element based on the initial attribute information of the first element.
The electronic device 10 may obtain the positioning result of the first element based on the initial attribute information of the first element. Specifically, the electronic device 10 may determine a first element code segment from the web document based on the initial attribute information of the first element, determine the first element in the web interface based on the corresponding relationship between the first element code segment and the first element, and obtain the positioning result of the first element. After positioning the first element, the electronic device 10 may simulate a keyboard and mouse operation on the area where the first element is located to perform a test operation on the first element, or the electronic device 10 may assign the first element to a storage object and perform a test operation on the first element by simulating an operation on the storage object.
It will be appreciated that the test operation may be a simulated keyboard input, a simulated mouse click, a simulated double click, or the like. The specific operation content of the trial operation may be determined based on the control information of the first element in the database.
S602, the electronic device 10 determines whether the trial operation on the first element is successful.
The electronic device 10 may determine the expected output information (which may also be referred to as the second information or the fourth information) of the electronic device 10 after receiving the attempted operation for the first element based on the control information for the first element in the database. The electronic device 10 may also determine the actual output information (which may also be referred to as the first information or the third information) of the electronic device 10 after performing the test operation on the first element.
The electronic device 10 may determine whether the trial operation was successful based on the actual results and the expected output information.
When the actual result is the same as the expected output information, the electronic device 10 determines that the trial operation is successful.
When the actual result is different from the expected output information, the electronic apparatus 10 determines that the trial operation has failed.
If the electronic device 10 successfully tries to operate the first element, the electronic device 10 performs the following step S603 to determine that the first element is a general element.
If the electronic device 10 fails to try to operate the first element, the electronic device 10 may execute the following step S604 to determine that the first element is a special element. In some embodiments, the electronic device 10 may further determine whether there is an influencing factor (external factor and/or internal factor) influencing the result of the trial operation, and in case that it is determined that there is no interference of the influencing factor, perform step S604 to determine that the first element is a special element.
It should be noted that, after the electronic device 10 fails to test the first element, the specific process of determining whether there is image factor interference by the electronic device 10 may include the following steps:
1. the electronic apparatus 10 determines whether or not there is an external factor that affects the trial operation.
External factors that affect the trial operation may include, but are not limited to, any one or more of the following: network connection is disconnected and web page operation is wrong.
Among other things, the electronic device 10 may check the network connection status of the electronic device 10 through a common network detection instruction (e.g., ping command, ipconfig command, etc.), determine whether the electronic device 10 is connected to a network, or determine whether the network connection of the electronic device 10 is stable. The electronic device 10 may monitor the operation status of the website through a console in the developer tool interface, and determine whether the website is operating normally by determining a website request Header (HEAD).
When it is determined that there is no external factor affecting the trial operation, the electronic apparatus 10 may perform steps 3 to 6 described below.
When it is determined that there are external factors affecting the trial operation, the electronic device 10 may perform step 2 described below.
2. When it is determined that there are external factors affecting the trial operation, the electronic device 10 reports an error, prompting the user that there are external factors affecting the trial operation.
The electronic device 10 may report the error in one or more of audio, picture, video, text, etc.
3. When it is determined that there is no external factor affecting the trial operation, the electronic device 10 acquires real-time attribute information of the first element.
The manner in which the electronic device 10 obtains the real-time attribute information of the first element may refer to the embodiment shown in fig. 4 described below.
4. The electronic device 10 determines whether the real-time attribute information of the first element is the same as the initial attribute information of the first element.
When the initial attribute information of the first element is different from the real-time attribute information, the electronic device 10 may determine that the first element is a special element.
When the real-time attribute information of the first element is the same as the initial attribute information of the first element, the electronic device 10 performs step 5, excluding internal factors that affect the trial operation.
5. The electronic device 10 performs adjustment operations that may include, but are not limited to, any one or more of the following: adjusting element latency, checking if there is a page window switch or iframe nest, adjusting the current page window or iframe.
The operation in step 5 can exclude the influence of most internal factors on the trial operation.
6. The electronic device 10 performs the trial operation on the first element again, and determines whether the first element is a special element based on the result of the trial operation.
S603, the electronic device 10 determines that the first element is a general element.
If the first element is successfully operated by the electronic device 10, it indicates that the first element can be located based on the initial attribute information of the first element, that is, the first element is a general element.
In some embodiments, after determining that the first element is a general element, the electronic device 10 may store the category identification of the first element in a database. The category identifier may be embodied as a value of a flag, and when the value of the flag of the first element is a first value (e.g., "0"), the first element is a general element. When the value of the flag of the first element is a second value (for example, "1"), the first element is a special element. The first value is different from the second value, and the specific values of the first value and the second value are not limited in this embodiment.
It is understood that the category label is only an example, and in some embodiments, the category label may also be other labels that can be used for general elements and special elements, and the present application is not limited thereto.
The electronic device 10 may store the category identification of the first element in the attribute database, or may store it elsewhere.
Illustratively, table 4 shows attribute information and category identification of a first element stored in an attribute database.
TABLE 4 Attribute information and Category identification of the first element
As shown in table 4, the information related to the first element in the attribute database may include initial attribute information of the first element and a category identification of the first element. The initial attribute information of the first element may include id and Xpath information of the first element, and the category identifier of the first element may be represented as a value of flag. As can be seen from table 4, the initial attribute information of the first element is as follows: id is h1, and Xpath information is/html/body/div 2. The value of the flag, which is the category identifier of the first element, is a first value, which indicates that the first element is a general element, and the first value may be 0.
It is understood that the attribute information and the category identification of the first element shown in table 4 are only examples, in this embodiment, the attribute information of the first element stored by the electronic device 10 may include more or less contents, and the category identification of the first element may also take other different forms, and this application is not limited herein.
In this case, if the attribute information of the first element is not stored in the database, the electronic device 10 may store the initial attribute information of the first element in the database.
S604, the electronic device 10 determines that the first element is a special element.
In some embodiments, after determining that the first element is a special element, the electronic device 10 may store the category identification of the first element in a database.
In some embodiments, the electronic device 10 may store the category identification of the first element in an attribute database.
Illustratively, table 5 shows attribute information and category identification for a first element stored in an attribute database.
TABLE 5 Attribute information and Category identification of the first element
As shown in table 5, the information related to the first element in the attribute database may include initial attribute information of the first element and a category identification of the first element. The initial attribute information of the first element may include id and Xpath information of the first element, and the category identifier of the first element may be represented as a value of a flag. As can be seen from table 5, the initial attribute information of the first element is as follows: id is h1, and Xpath information is/html/body/div 2. The value of the class flag of the first element is a second value, indicating that the first element is a special element. The second value may be 1, and the embodiment of the present application does not limit a specific value of the second value.
It should be understood that the attribute information and the category identifier of the first element shown in table 5 are only examples, in this embodiment, the attribute information of the first element stored by the electronic device 10 may include more or less contents, and the category identifier of the first element may also take other different forms, which is not limited herein.
In some embodiments, if the electronic device 10 further acquires the real-time attribute information of the first element in step S602, the electronic device 10 may also store the real-time attribute information of the first element in the database.
Illustratively, table 6 shows attribute information and a category identification for a first element in another attribute database.
Table 6 attribute information and category identification of first element
As shown in table 6, the information related to the first element in the attribute database may include attribute information of the first element and a category identification of the first element. The attribute information of the first element may include initial Xpath information of the first element and current Xpath information of the first element, and the category identifier of the first element may be represented as a value of a flag. As can be seen from Table 6, the initial XPath information of the first element is/html/body/div [2]/div [2], and the current XPath information of the first element is/html/body/div [2]/div [4]. The value of the flag, which is the category identifier of the first element, is a second value, which indicates that the first element is a special element, and the second value may be 1.
It is understood that the attribute information and the category identification of the first element shown in table 6 are only examples, in this embodiment, the attribute information of the first element stored by the electronic device 10 may include more or less contents, and the category identification of the first element may also take other different forms, and this application is not limited herein.
In some embodiments, when storing the real-time attribute information of the first element, optionally, the electronic device 10 may also delete the initial attribute information of the first element stored in the database.
By using the method shown in fig. 6, all the elements to be tested in the web interface may be classified through the recognition operation, and optionally, the category identifiers corresponding to the elements may also be stored in the database. In this way, in the subsequent web page test process, the electronic device 10 may determine whether to acquire real-time attribute information of the element based on the category of the element so as to perform a function detection operation on the element, and determine whether the function of the element is normal.
In some embodiments, the electronic device 10 may also store the category identification of the first element after determining the category of the first element. After storing the category identifiers of all the elements to be tested in the web interface, the electronic device 10 may sequentially obtain the category identifiers of the elements to be tested according to a certain sequence, and determine whether the elements to be tested are special elements, so as to perform a function test on the elements subsequently.
Fig. 7 shows a flowchart for determining whether an element is a special element based on the class identifier of the element provided in the embodiment of the present application.
S701, the electronic device 10 obtains the category identifier of the first element.
When the electronic device 10 stores the category identification of the first element, the electronic device 10 may obtain the category identification of the first element.
In some embodiments, the electronic device 10 may determine the category of the first element in the manner illustrated in FIG. 6 and store the category identification of the first element in the database.
S702, the electronic device 10 determines the category of the first element based on the category identification of the first element.
The electronic device 10 may determine the category of the first element based on the category identification of the first element. For example, when the value of the category identifier flag of the first element is the second value, the electronic device 10 determines that the first element is a special element; when the value of the first element's category flag is the first value, the electronic device 10 determines that the first element is a general element.
By adopting the method shown in fig. 7, it can be determined whether the element to be tested is a special element, and it can be determined whether to acquire the real-time attribute information of the element based on the category of the element to be tested, so as to perform subsequent functional test.
The following describes functional modules of an electronic device 20 provided in the present application.
Fig. 8 shows a functional module diagram of an electronic device 20 provided in an embodiment of the present application.
As shown in fig. 8, the electronic device 20 may include a browser end 810 and a testing end 820. The browser end 810 may include a display module 811 and an interaction module 812, and the testing end 820 may include an element collection module 821, an element identification module 822, an element location and verification module 823, a database module 824, and a use case execution module 825. The browser end 810 and the test end 820 may communicate using the HTTP protocol.
The display module 811 may display a web interface (e.g., the web interface 300 shown in fig. 2B, etc.) and may also display a developer tool interface (e.g., the developer tool interface 400 shown in fig. 2C).
The interaction module 812 may receive the function detection operation instruction sent by the test end 820, and perform a corresponding operation on an element in the web interface. In some embodiments, the interaction module 812 may also receive an operation performed by a user on an element in the web interface through a keyboard and/or a mouse, and perform a corresponding operation on the element.
Element collection module 821 may collect initial attribute information for elements in the web interface and send the initial attribute information for the elements to database module 824. In some embodiments, the element collection module 821 may also send the initial attribute information of the element (e.g., the initial attribute information of the first element) to the element identification module 822 after collecting the initial attribute information of the element.
Element identification module 822 may obtain initial attribute information for any one of the elements stored in the database (e.g., initial attribute information for the first element) from database module 824, and may also receive initial attribute information for the first element sent by element collection module 821. After obtaining the initial attribute information for the first element, element identification module 822 may identify a category of the first element, determine whether the first element is a special element, and send the category of the first element to database module 824. In some embodiments, after determining that the first element is a special element, the element identification module 822 may also send the initial attribute information of the first element to the element location and verification module 823. In other embodiments, after determining that the first element is a general element, the element identification module 822 may further send initial attribute information of the first element to the use case execution module 825.
The element location and verification module 823 may receive initial attribute information of the first element of the category of the special element sent by the element identification module 822. Initial attribute information for the first element of the category special element may also be obtained from database module 824. After obtaining the initial attribute information of the first element, the element positioning and checking module 823 may obtain real-time attribute information of the first element based on the initial attribute information of the first element. Optionally, the element positioning and checking module 823 may also check the real-time attribute information of the first element. The element location and verification module 823 may send the real-time attribute information for the first element to the database module 824. In some embodiments, after determining the real-time attribute information of the first element, the element location and verification module 823 may also send the real-time attribute information of the first element to the use case execution module 825.
Database module 824 can store attribute information (initial attribute information and/or real-time attribute information), category identification, and control information for one or more elements to be tested in a web interface. The one or more elements to be tested may include a first element.
The use case execution module 825 may locate the first element based on the attribute information (initial attribute information or real-time attribute information) of the first element and perform a functional test.
It is understood that the functional module structure of the electronic device 20 shown in fig. 8 is just an example, the electronic device 20 may further include more or less functional modules than those shown in fig. 8, and in some embodiments, the browser end 810 and the testing end 820 may also be respectively located in different electronic apparatuses, and the application is not limited thereto.
Finally, the electronic device provided by the present application is described below.
Fig. 9 is an exemplary schematic diagram of a hardware structure of the electronic device 10 according to an embodiment of the present disclosure.
The following describes an embodiment specifically by taking the electronic device 10 as an example. It should be understood that electronic device 10 may have more or fewer components than shown, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The electronic device 10 may include: a processor 110, a bus and interface 120, a Random Access Memory (RAM) 130, a non-volatile memory (NVM) 140, a sensor module 150, a communication module 160, a display module 170, and the like. The nonvolatile memory includes a ROM/flash memory.
It should be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: a Memory Management Unit (MMU), a Memory Protection Unit (MPU), an arithmetic unit, a controller, a register, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The bus and interface 120 may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
It should be understood that the connection relationship between the modules according to the embodiment of the present invention is only illustrative, and does not limit the structure of the electronic device 10. In other embodiments of the present application, the electronic device 10 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The random access memory 130 may include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), such as fifth generation DDR SDRAM generally referred to as DDR5 SDRAM, and the like.
The nonvolatile memory 140 may include a magnetic disk storage device, a flash memory (flash memory). The FLASH memory may include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operation principle, may include single-level cells (SLC), multi-level cells (MLC), three-level cells (TLC), four-level cells (QLC), etc. according to the level order of the memory cells, and may include universal FLASH memory (UFS), embedded multimedia memory cards (eMMC), etc. according to the storage specification.
The random access memory 130 may be directly read from or written to by the processor 110, may be used for storing executable programs (e.g., machine instructions) of an operating system or other programs in operation, and may also be used for storing data of users and application programs, etc.
The nonvolatile memory 140 may also store executable programs, data of users and application programs, and the like, and may be loaded in advance into the random access memory for the processor 110 to directly read and write. In some embodiments, the non-volatile memory 140 may also store any one or more of the following: attribute information (initial attribute information and/or real-time attribute information) of the element to be tested, category identification, control information, and the like. Optionally, the nonvolatile memory 140 may store the attribute information and the category identifier of the element to be tested in the attribute database, and store the control information of the element to be tested in the control database.
The sensor module 150 is an optional module. The sensor module 150 may include any one or more of a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, an ambient light sensor, a fingerprint sensor, a touch sensor, a bone conduction sensor, and the like.
The communication module 160 may include a mobile communication module, a wireless communication module.
The display module 170 may include a display screen.
The embodiments of the present application can be combined arbitrarily to achieve different technical effects.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
One of ordinary skill in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by hardware related to instructions of a computer program, which may be stored in a computer-readable storage medium, and when executed, may include the processes of the above method embodiments. And the aforementioned storage medium includes: various media capable of storing program codes, such as ROM or RAM, magnetic or optical disks, etc.
In short, the above description is only an example of the technical solution of the present invention, and is not intended to limit the scope of the present invention. Any modifications, equivalents, improvements and the like made in accordance with the disclosure of the present invention are intended to be included within the scope of the present invention.
Claims (12)
1. A web page testing method is characterized by comprising the following steps:
acquiring initial attribute information of a first element in a first webpage interface;
determining a category of the first element based on preset identification information;
acquiring positioning information of the first element based on the category of the first element and the initial attribute information;
determining a functional state of the first element based on the positioning information of the first element.
2. The method of claim 1, wherein the category comprises a specified element; the obtaining the positioning information of the first element based on the category of the first element and the initial attribute information of the first element comprises:
if the first element is the designated element, acquiring real-time attribute information of the first element based on the initial attribute information of the first element;
and acquiring the positioning information of the first element based on the real-time attribute information of the first element.
3. The method of claim 2, wherein the obtaining real-time attribute information of the first element based on the initial attribute information of the first element comprises:
determining first coordinate information of the first element in a first coordinate system based on the initial attribute information of the first element, wherein the first coordinate system is a two-dimensional coordinate system with a first point in the first webpage interface as an origin;
determining second coordinate information of the first element in a second coordinate system based on the first coordinate information, wherein the second coordinate system is a two-dimensional coordinate system with a second point of a display screen as an origin, and the display screen is used for displaying the first webpage interface;
capturing the first element based on the second coordinate information, and determining third coordinate information of the first element code segment corresponding to the first element in the second coordinate system;
and executing attribute information acquisition operation on the first element code segment based on the third coordinate information to acquire real-time attribute information of the first element.
4. The method according to any one of claims 1 to 3, wherein the preset identification information comprises a category identification of the first element; the determining the category of the first element based on preset identification information includes:
acquiring the category identification of the first element from the preset identification information;
determining a category of the first element based on the category identification of the first element.
5. The method of claim 4, wherein the categories further include general elements; before the obtaining of the category identifier of the first element based on the preset identification information, the method further includes:
performing an identification operation on the first element based on initial attribute information of the first element;
if the identification operation is successful, determining that the class identifier of the first element is the class identifier of the general element;
if the identification operation fails, determining that the category identifier of the first element is the category identifier of the specified element;
and taking the category identification of the general element or the category identification of the specified element as preset identification information.
6. The method of claim 4 or 5, wherein the determining the category of the first element based on the category identification of the first element comprises:
if the category identification of the first element is the same as the category identification of the specified element, determining that the category of the first element is the specified element;
and if the category identification of the first element is the same as the category identification of the general element, determining that the category of the first element is the general element.
7. The method according to any of claims 1-6, wherein the positioning information is:
fourth coordinate information of the first object or the first element in the second coordinate system; wherein the first object has the first element stored therein; the second coordinate system is a two-dimensional coordinate system with a second point of the display screen as an origin, and the display screen is used for displaying the first webpage interface.
8. The method of claim 7, wherein when the positioning information is a first object, the determining the functional state of the first element based on the positioning information of the first element comprises:
performing a function detection operation on the first object;
outputting first information in response to the function detection operation;
determining that the first element functions normally when the first information is the same as the second information;
determining that the first element is dysfunctional when the first information is different from the second information;
and the second information is preset output information corresponding to the function detection operation.
9. The method according to claim 7, wherein when the positioning information is fourth coordinate information, the determining the functional state of the first element based on the positioning information comprises:
performing a function detection operation on the area indicated by the fourth coordinate information;
outputting third information in response to the function detection operation;
when the third information is the same as the fourth information, determining that the first element is normal in function;
determining that the first element is dysfunctional when the third information is different from fourth information;
and the fourth information is preset output information corresponding to the function detection operation.
10. The method of claim 5, wherein when the identifying operation fails, the method further comprises:
and if external factors influencing the identification operation exist, outputting an error prompt, wherein the external factors comprise network connection disconnection and/or a first webpage interface operation error.
11. The method of claim 10, wherein when there are no external factors affecting the identifying operation, the method further comprises:
acquiring real-time attribute information of the first element;
when the initial attribute information of the first element is the same as the real-time attribute information of the first element, performing any one or more of the following operations: adjusting element latency, adjusting current page window, and adjusting iframe nesting.
12. An electronic device, comprising: one or more processors, one or more memories; the one or more memories coupled with the one or more processors for storing computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the method of any of claims 1-11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211158047.1A CN115904934A (en) | 2022-09-22 | 2022-09-22 | Webpage testing method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211158047.1A CN115904934A (en) | 2022-09-22 | 2022-09-22 | Webpage testing method and related device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115904934A true CN115904934A (en) | 2023-04-04 |
Family
ID=86484982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211158047.1A Pending CN115904934A (en) | 2022-09-22 | 2022-09-22 | Webpage testing method and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115904934A (en) |
-
2022
- 2022-09-22 CN CN202211158047.1A patent/CN115904934A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10713149B2 (en) | Processing automation scripts of software | |
US11822919B2 (en) | Auto-generation of API documentation via implementation-neutral analysis of API traffic | |
US9507698B2 (en) | Test code generation based on test documentation | |
CN108762743B (en) | Data table operation code generation method and device | |
US20160259773A1 (en) | System and method for identifying web elements present on a web-page | |
US10303751B1 (en) | System and method for interaction coverage | |
CN102804147A (en) | Code inspection executing system for performing a code inspection of ABAP source codes | |
US12079298B2 (en) | Methods and systems for browser extension used to generate relative XPath, absolute XPath and/or CSS selectors | |
CN112241370B (en) | API interface class checking method, system and device | |
US10705949B2 (en) | Evaluation of library test suites using mutation testing | |
CN111679976A (en) | Method and device for searching page object | |
CN104391796A (en) | Method for parsing test cases | |
US20150020045A1 (en) | Method, device and computer-readable storage medium for closure testing | |
CN111966580A (en) | Automatic testing method, device, equipment and storage medium based on artificial intelligence | |
US20160034378A1 (en) | Method and system for testing page link addresses | |
CN113987393A (en) | Web page operation recorder, system, device and method | |
CN107797917B (en) | Performance test script generation method and device | |
CN112667502A (en) | Page testing method, device and medium | |
CN116166533A (en) | Interface testing method, device, terminal equipment and storage medium | |
CN115904934A (en) | Webpage testing method and related device | |
CN115481025A (en) | Script recording method and device for automatic test, computer equipment and medium | |
CN114297055A (en) | WebUI automatic testing method based on intelligent learning | |
CN114780420A (en) | Method, device, equipment and storage medium for automatic test based on test case | |
CN113238940A (en) | Interface test result comparison method, device, equipment and storage medium | |
Watanabe et al. | Layout Cross-Browser Failure Classification for Mobile Responsive Design Web Applications: Combining Classification Models Using Feature Selection |
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 |