Webpage testing method and device, electronic equipment and storage medium
By receiving web page test requests, creating and building web page decision trees, generating test paths, and conducting web page tests, the problem of unavailability of test cases in the existing technology is solved, and efficient and automated web page testing is achieved.
Patent Information
- Application Number
- CN202510272083.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, web page updates make the original test cases unavailable and require testers to rewrite, which affects the efficiency of web page testing.
A web testing method is proposed. By receiving web testing requests, creating the original web decision tree, and node building the decision tree based on the target web page, generating web testing paths, and performing web testing to obtain feedback information.
It realizes the automation and efficiency of web testing, reduces the need for testers to manually write test cases, and improves test efficiency and quality.
Smart Images

Figure CN120104504A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and is applicable to financial technology scenarios and medical technology scenarios, and in particular to a web page testing method and device, electronic equipment, and storage medium. Background Art
[0002] Web page testing can be used to verify and evaluate the functionality, performance, compatibility, and security of web pages to ensure that they meet design requirements and user expectations. Web page testing can be applied to a variety of application scenarios. For example, in the financial technology scenario, web page testing can be performed on the auto insurance application web page to improve the security and robustness of the auto insurance application web page; in the medical technology scenario, web page testing can be performed on the hospital portal website to improve the security and robustness of the hospital portal website.
[0003] At present, testers are mainly used to write test cases corresponding to web pages. However, in actual application scenarios, the update of web pages may change the functions or operation processes of web pages, making the original test cases unusable and requiring testers to rewrite them, thus affecting the efficiency of web page testing.
[0004] Therefore, how to improve the efficiency of web page testing has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of the embodiments of the present application is to provide a web page testing method and device, an electronic device and a storage medium, aiming to improve the efficiency of web page testing.
[0006] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a web page testing method, the method comprising:
[0007] Receiving a web page test request; wherein the web page test request includes a target web page;
[0008] Creating an original web page decision tree according to the web page test request;
[0009] Based on the target web page, nodes of the original web page decision tree are constructed to obtain a target web page decision tree;
[0010] Generate a webpage test path based on the target webpage decision tree;
[0011] A web page test is performed on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or has failed the web page test.
[0012] In some embodiments, constructing nodes of the original webpage decision tree based on the target webpage to obtain the target webpage decision tree includes:
[0013] Initializing a web page browsing instance based on the target web page; wherein the web page browsing instance is used to browse the target web page, the web page browsing instance includes a current web page window, and the current web page window is used to render the target web page;
[0014] Performing a forward traversal on the original webpage decision tree to obtain a current decision path and a current node located on the current decision path;
[0015] Obtaining page elements of the target web page in the current web page window to obtain a current page element set;
[0016] Filtering candidate execution elements from the current page element set based on the original web page decision tree;
[0017] Obtaining execution feedback information after the candidate execution element is executed;
[0018] The original webpage decision tree is updated according to the execution feedback information and the current node to obtain the target webpage decision tree.
[0019] In some embodiments, updating the original webpage decision tree according to the execution feedback information and the current node to obtain the target webpage decision tree includes:
[0020] Determine, according to the execution feedback information, a jump webpage triggered after the candidate execution element is executed;
[0021] If the jump page is a new web page, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, so as to update the original web page decision tree and obtain the target web page decision tree.
[0022] In some embodiments, after determining the jump webpage triggered after the candidate execution element is executed according to the execution feedback information, the method further includes:
[0023] If the jump page is the target web page, taking a screenshot of the page of the current web page window to obtain a screenshot of the current page;
[0024] Determine an ancestor node based on the current decision path, and obtain a historical page screenshot of the ancestor node;
[0025] If the current page screenshot is the same as the historical page screenshot, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path to update the original web page decision tree to obtain the target web page decision tree.
[0026] In some embodiments, after determining the ancestor node based on the current decision path and obtaining the historical page screenshot of the ancestor node, the method further includes:
[0027] If the current page screenshot is different from the historical page screenshot, obtaining the child node of the current node to obtain the current child node; wherein the current child node includes page element parameters;
[0028] Based on the page element parameters, the current sub-nodes are merged to obtain a target sub-node;
[0029] The target child node is confirmed as a child node of the current node to update the original webpage decision tree to obtain the target webpage decision tree.
[0030] In some embodiments, acquiring page elements of the target web page in the current web page window to obtain a current page element set includes:
[0031] Determining rendering position information of the target web page based on the current web page window;
[0032] Determining page rendering content of the target webpage based on the rendering position information;
[0033] Extracting elements from the page rendering content through a preset decision tree generation plug-in to obtain original page elements;
[0034] The original page elements are screened based on preset element types to obtain a current page element set; wherein the preset element types include click event element types and scroll event element types.
[0035] In some embodiments, performing a web page test on the target web page based on the web page test path to obtain web page test feedback information includes:
[0036] Determine the test execution nodes and the node execution order according to the web page test path;
[0037] Screening elements from the target web page based on the test execution node to obtain candidate page elements;
[0038] The candidate page elements are executed based on the node execution order to obtain the web page test feedback information.
[0039] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a web page testing device, the device comprising:
[0040] A test request receiving module, used to receive a web page test request; wherein the web page test request includes a target web page;
[0041] An original decision tree creation module, used to create an original web page decision tree according to the web page test request;
[0042] A decision tree node construction module, used to construct nodes of the original webpage decision tree based on the target webpage to obtain a target webpage decision tree;
[0043] A test path generation module, used to generate a web page test path based on the target web page decision tree;
[0044] The target testing module is used to perform a web page test on the target web page based on the web page testing path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test.
[0045] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0046] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0047] The web page testing method and device, electronic device and storage medium proposed in the present application receive a web page test request; wherein the web page test request includes a target web page, and creates an original web page decision tree according to the web page test request; based on the target web page, the original web page decision tree is constructed with nodes to obtain a target web page decision tree, which can efficiently and logically sort out various functions in the target web page, realize automatic generation of the decision tree, and ensure the comprehensiveness and accuracy of the web page decision tree. Then, a web page test path is generated based on the target web page decision tree, and a web page test is performed on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test, effectively improving the efficiency and quality of the web page test. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 is a flow chart of a web page testing method provided by an embodiment of the present application;
[0049] Figure 2 yes Figure 1 Flow chart of step S103 in FIG.
[0050] Figure 3 yes Figure 2 Flow chart of step S203 in FIG.
[0051] Figure 4 yes Figure 2 Flow chart of step S206 in FIG.
[0052] Figure 5 is a flow chart of a web page testing method provided by another embodiment of the present application;
[0053] Figure 6 is a flow chart of a web page testing method provided by another embodiment of the present application;
[0054] Figure 7 yes Figure 1 Flow chart of step S105 in FIG.
[0055] Figure 8 is a structural schematic diagram of a web page testing device provided in an embodiment of the present application;
[0056] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0058] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0060] First, some nouns involved in this application are analyzed:
[0061] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0062] Web page testing refers to a series of verification and evaluation activities conducted on web applications during the software development process to ensure that they can operate normally as expected and meet user needs in various environments and conditions. The web page testing process covers multiple dimensions such as functional testing, performance testing, compatibility testing, and security testing. Functional testing mainly verifies whether the various functions of the web page are implemented and meet expectations, including link jumps, form submissions, data interaction, etc.; performance testing focuses on the loading speed, response time, and stability of the web page under high concurrency; compatibility testing ensures that the web page can be displayed and run correctly on different browsers, operating systems, and devices; security testing checks whether the web page has security vulnerabilities, such as SQL injection and cross-site scripting attacks. Web page testing not only helps to discover and fix potential problems, but also improves user experience and enhances the reliability and security of web pages. By combining automated testing tools and manual testing methods, developers can implement web page testing comprehensively and efficiently, thereby providing users with high-quality and reliable web application services.
[0063] Web page testing can be applied to a variety of application scenarios. For example, in the financial technology scenario, web page testing can be performed on car insurance application pages and investment consulting websites to improve the security and robustness of the web pages. In the medical technology scenario, web page testing can be performed on hospital portals and online registration systems to improve the security and robustness of hospital websites.
[0064] Web page decision tree, a web page decision tree refers to a decision analysis model presented in a tree structure when processing data related to web pages. In the model, each internal node represents a test of a certain attribute or condition, each branch represents a different result of the test, and each leaf node represents the final decision or prediction result. This tree structure makes the decision process intuitive and easy to understand, and is suitable for scenarios such as classification, prediction or decision support of web page data. The web page decision tree can be used as an auxiliary tool or result presentation method in web page testing. When conducting web page testing, testers build a web page decision tree, which can help testers better understand the behavior and performance of the web page, thereby discovering potential problems or improvement points, and providing strong support for subsequent web page optimization and decision-making.
[0065] Headless browser, a headless browser refers to a web browser without a graphical user interface (GUI). A headless browser does not rely on the graphical interface of the operating system, and its operation and operation are all completed in memory, so it executes faster. Headless browsers are mainly used by software testing engineers, especially playing an important role in web page testing. Through a headless browser, testers can perform end-to-end testing and interact directly with the page, thereby quickly and efficiently verifying various automated tasks, performance, and layout of the website, which can improve testing efficiency and accuracy.
[0066] At present, web page testing mainly relies on testers to write and maintain test cases corresponding to web pages. However, in actual application scenarios, the update of web pages may change the functions or operation processes of web pages, making the original test cases unusable and requiring testers to rewrite them, which may lead to inefficiency and human omissions, thus affecting the efficiency of web page testing.
[0067] Based on this, the embodiments of the present application provide a web page testing method and device, an electronic device and a storage medium, aiming to improve the efficiency of web page testing.
[0068] The web page testing method and device, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the web page testing method in the embodiments of the present application is described.
[0069] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0070] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0071] The web page testing method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The web page testing method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the web page testing method, etc., but is not limited to the above forms.
[0072] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0073] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0074] Figure 1 is an optional flowchart of the web page testing method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S105.
[0075] Step S101, receiving a web page test request; wherein the web page test request includes a target web page;
[0076] Step S102, creating an original web page decision tree according to the web page test request;
[0077] Step S103, constructing nodes of the original webpage decision tree based on the target webpage to obtain the target webpage decision tree;
[0078] Step S104, generating a webpage test path based on the target webpage decision tree;
[0079] Step S105 , performing a web page test on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or has failed the web page test.
[0080] Steps S101 to S105 shown in the embodiment of the present application are performed by receiving a web page test request; wherein the web page test request includes a target web page, and an original web page decision tree is created according to the web page test request; nodes of the original web page decision tree are constructed based on the target web page to obtain a target web page decision tree, which can efficiently and logically sort out various functions in the target web page, realize automatic generation of the decision tree, and ensure the comprehensiveness and accuracy of the web page decision tree. Then, a web page test path is generated based on the target web page decision tree, and a web page test is performed on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test, effectively improving the efficiency and quality of the web page test.
[0081] In step S101 of some embodiments, a web page test request is received, where the web page test request can be obtained through multiple channels, for example: a web page tester manually submits a web page test request through a web page interface, mobile application or other client tool; it may also be generated by an automated testing system or tool, which automatically sends a web page test request to a test server according to a preset test plan, test script or test suite; it may also be possible to set up a continuous integration / continuous deployment (CI / CD) pipeline during the software development process, and trigger a web page test request through the continuous integration / continuous deployment (CI / CD) pipeline when the code base of the target web page changes, to ensure that the new code does not destroy existing functions.
[0082] Specifically, the webpage test request includes a specified target webpage, such as a webpage URL. The target webpage can be any page on a financial website, such as a car insurance purchase webpage, an investment consulting website, a financial news website, etc. in the financial technology scenario; a hospital portal website, an online registration system, an online consulting website, etc. in the medical technology scenario, but is not limited thereto.
[0083] In addition, web page test requests may also include but are not limited to:
[0084] Test parameters, such as browser type, screen resolution, operating system, etc., which are used to simulate different user environments and scenarios to ensure that the web page can work properly under various conditions;
[0085] Additional information, test description, expected results, test priority, etc., helps to better understand the test requirements and develop corresponding test plans.
[0086] In some embodiments, by receiving a web page test request, a web page decision tree corresponding to the target web page can be automatically generated in response to the web page test request, and the test process of the web page tester can be optimized, thereby improving the efficiency and quality of the web page test.
[0087] In step S102 of some embodiments, an original web page decision tree is created according to the web page test request. Specifically, the initial original web page decision tree only includes a root node, which represents the starting point of the web page test. Specific decision nodes and leaf nodes need to be constructed according to the target web page.
[0088] It should be noted that a web page decision tree is a tree structure used to guide web page testing. It consists of a root node, a series of decision nodes and leaf nodes. The root node represents the starting point of the web page test; each decision node represents an operation on a web page, such as clicking a button, scrolling a page, etc.; the leaf node is the end point of the decision tree, indicating the end of the test process or the achievement of a specific test condition. A test path is formed from the root node to the leaf node. The test path represents a test case for web page testing.
[0089] Web page decision tree has at least the following functions in web page testing:
[0090] Guide the testing process: The web page decision tree provides a clear and logical testing process. By testing in the order of nodes in the web page decision tree, the comprehensiveness and systematicness of the test can be ensured.
[0091] Improve test efficiency: With the guidance of the web page decision tree, you can quickly locate the web page elements or functions that need to be tested, avoid unnecessary repeated testing, and help improve test efficiency and quality.
[0092] Support automated testing: The structured characteristics of the web page decision tree make it easy to integrate with automated testing tools. By writing corresponding test scripts and logic, the automated execution and result analysis of web page testing can be achieved.
[0093] Facilitates result analysis and problem location: During the testing process, each node of the web page decision tree can record the test results and related information, which helps testers quickly locate the problem and make corresponding repairs and improvements.
[0094] See also Figure 2 In some embodiments, step S103 may include but is not limited to steps S201 to S206:
[0095] Step S201, initializing a web page browsing instance based on a target web page; wherein the web page browsing instance is used to browse the target web page, the web page browsing instance includes a current web page window, and the current web page window is used to render the target web page;
[0096] Step S202, traversing the original webpage decision tree to obtain a current decision path and a current node on the current decision path;
[0097] Step S203, obtaining page elements of the target web page in the current web page window to obtain a current page element set;
[0098] Step S204, screening out candidate execution elements from the current page element set based on the original webpage decision tree;
[0099] Step S205, obtaining execution feedback information after the candidate execution element is executed;
[0100] Step S206, updating the original web page decision tree according to the execution feedback information and the current node to obtain the target web page decision tree.
[0101] Steps S201 to S206 shown in the embodiment of the present application simulate real user browsing behavior by initializing a web page browsing instance, determine the current decision path and the current node on the current decision path in combination with the prior traversal of the original web page decision tree, obtain the page elements of the target web page in the current web page window in real time, obtain the current page element set, and select candidate execution elements from the current page element set as operation objects, collect execution feedback information after execution, and dynamically adjust the decision tree according to the execution feedback information, so as to automatically generate the target web page decision tree, effectively improving the accuracy and efficiency of web page testing.
[0102] In step S201 of some embodiments, the web browsing instance is a running instance of a headless browser, which is a virtual browser environment, including a complete browser kernel, capable of loading, parsing and rendering web pages. Among them, the current web page window is a key component in the headless browser, simulating the visible area of the browser and responsible for rendering the content of the target web page.
[0103] Through web browsing instances, the browsing behavior of real users can be automatically simulated, including loading web pages, interacting with page elements, etc., so as to more accurately build a web decision tree; and, by using web browsing instances, the graphical interface is not displayed, which reduces resource consumption and improves test efficiency.
[0104] In step S202 of some embodiments, by traversing the original web page decision tree and recording the current decision path, all decision processes from the root node to the current node can be clearly understood, ensuring that each node is visited, thereby ensuring the integrity and accuracy of the decision path.
[0105] It should be noted that the current decision path is a path without a "leaf node", and the current node is the last node in the current decision path, but is not a leaf node.
[0106] In some embodiments, the current node can be the root node of the original web page decision tree. For example, if there are multiple leaf nodes in the current original web page decision tree, in order to perform a new round of first-follow traversal, the current decision path will be created starting from the root node. The root node is the only node in the current decision path, so the current node is the root node.
[0107] See also Figure 3In some embodiments, step S203 may include but is not limited to steps S301 to S304:
[0108] Step S301, determining rendering position information of a target web page based on the current web page window;
[0109] Step S302, determining the page rendering content of the target webpage based on the rendering position information;
[0110] Step S303, extracting elements from the page rendering content through a preset decision tree generation plug-in to obtain original page elements;
[0111] Step S304, filtering the original page elements based on preset element types to obtain a current page element set; wherein the preset element types include click event element types and scroll event element types.
[0112] Steps S301 to S304 shown in the embodiment of the present application can accurately locate the page rendering content of the target web page by determining the rendering position information of the target web page in the current web page window. Then, the rendered content is extracted using a preset decision tree generation plug-in, which can automatically identify and separate the page elements of the page. Finally, the original page elements are finely screened by the preset element type, and the elements of the click event element type and the scroll event element type are found to construct the current page element set, which can quickly find the page elements that need to be tested on the web page, which helps to improve the construction efficiency and automation of the web page decision tree, thereby improving the efficiency and quality of web page testing.
[0113] In some embodiments, the rendering position information is obtained by parsing HTML, CSS and other files in the web browsing instance to calculate the position and size of each page element in the target web page, and then determining the page rendering content of the target web page based on the rendering position information. It can accurately determine which page elements are visible in the current web page window and which ones need to be scrolled or the window adjusted to be seen, which helps to improve the accuracy of web page element extraction.
[0114] In some embodiments, the preset decision tree generation plug-in is an auxiliary plug-in preset in the headless browser, and the decision tree generation plug-in can implement:
[0115] (1) Rewrite the addEventListener event of the native EventTarget of the page to listen to all document object model elements (DOM elements) bound to click events (onClick events) in the target web page;
[0116] Regularly traverse the DOM tree to find all document object model elements in the target web page that are bound to click events, that is, page elements of the click event type;
[0117] Assign UUIDs to the document object model elements bound to click events and create a click event element mapping table.
[0118] Bind the intersectionObserver event to each element in the click event element mapping table to obtain the visible document object model elements in the current web page window.
[0119] (2) Traverse all scrollable DOM elements in the current web page window, that is, page elements of the scroll event type, and assign a UUID to the scrollable DOM element. The UUID is stored together with the current scrollable scrollTop distance as a unique value in the scroll event element mapping table.
[0120] For example: {
UUID
[0121] The height of the scrollable parent element is 100px, and the height of the child element is 300px. Then the records stored in scrollTop are 100 and 200, and the nodes are divided based on the principle of minimum display completion.
[0122] (3) Listen to the MutationObserver event and monitor all element changes or attribute changes to distinguish the basis for changes in page elements.
[0123] In some embodiments, before step S303, the webpage testing method further includes:
[0124] All document object model elements and scrollable document object model elements bound to click events in the target web page are obtained in advance through the decision tree generation plug-in, and UUIDs are assigned to the document object model elements bound to click events and scrollable document object model elements respectively to facilitate element search in the subsequent decision tree construction process.
[0125] In step S303 of some embodiments, a decision tree generation plug-in is used to extract document object model elements bound to click events and scrollable document object model elements from page rendering content to obtain original page elements.
[0126] Specifically, the original page elements obtained are all corresponding UUIDs, which help to more accurately identify and operate target elements in scenarios such as web page testing, data crawling, and automated operations.
[0127] In some embodiments, after step S303 and before step S304, if the original page element is empty, that is, it does not contain any page elements, and is even less likely to contain elements of click event element types and / or scroll event element types, it means that there are no executable page elements in the current web page window, then the decision tree construction process is terminated, and the current original decision tree is used as the target decision tree.
[0128] In step S304 of some embodiments, by filtering the original page elements based on preset element types to obtain the current page element set, it is possible to quickly determine whether there are executable page elements (elements of click event element types and / or scroll event element types) in the current web page window, thereby facilitating the subsequent execution of the decision tree construction process.
[0129] Similarly, if the current page element set is empty, that is, it does not contain elements of click event element type and / or scroll event element type, it means that there are no executable page elements in the current web page window, then the decision tree construction process is terminated and the current original decision tree is used as the target decision tree.
[0130] In some embodiments, step S204 may include but is not limited to the following steps:
[0131] Obtain the historical execution node of the original webpage decision tree; the historical execution node includes the historical execution page element;
[0132] Based on the historical execution page elements, the current page elements are deduplicated to obtain candidate execution elements.
[0133] By removing the executed elements in the current page elements and obtaining the candidate execution elements that have not been executed, it is possible to avoid repeating the same operation, improve the efficiency of decision tree construction, and help improve the efficiency and accuracy of web page testing.
[0134] Similarly, if the candidate execution element is empty, that is, it does not contain elements of the click event element type and / or the scroll event element type, it means that there are no unexecuted page elements in the current web page window, then the decision tree construction process is terminated and the current original decision tree is used as the target decision tree.
[0135] In step S205 of some embodiments, the candidate execution element is executed, and execution feedback information after the execution is obtained, wherein the execution feedback information can represent:
[0136] After execution, whether to jump to a web page other than the target web page,
[0137] If the target webpage is still in the execution state, it is determined whether any element of the target webpage has changed, such as a pop-up window or page movement.
[0138] See also Figure 4 In some embodiments, step S206 may include but is not limited to steps S401 to S402:
[0139] Step S401, determining the jump webpage triggered after the candidate execution element is executed according to the execution feedback information;
[0140] Step S402: If the jump page is a new web page, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, so as to update the original web page decision tree and obtain the target web page decision tree.
[0141] In the steps S401 to S402 shown in the embodiment of the present application, the jump webpage triggered by the execution of the candidate execution element is determined according to the execution feedback information to determine whether the webpage has changed. If the jump webpage is a new webpage, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, and the original webpage decision tree is updated, thereby ensuring the accuracy and completeness of the decision tree construction, and effectively simulating and predicting the user's behavior path in the target webpage.
[0142] It should be noted that the jump webpages triggered after the candidate execution element is executed include: a target webpage and a new webpage, and the new webpage is a webpage other than the target webpage.
[0143] Among them, the hash of the current page can be used to determine whether the next page has been entered. Taking a headless browser as an example, it can be determined whether the page address has changed after waiting for a period of time.
[0144] A background system may also be set up to determine whether the decision tree generation plug-in has been newly initialized. The newly opened web page may also be connected in series by splicing the UUID corresponding to the document object model element (DOM element) to the link.
[0145] In step S402 of some embodiments, if the jump page is a new web page, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, indicating that the current decision path ends, and the original web page decision tree is updated.
[0146] After step S402 in some embodiments, the above steps S201 to S205 are returned to be executed to implement a comprehensive decision tree construction process for the target web page.
[0147] In addition, for the new web page, the web page testing process illustrated in the above steps S102 to S105 is performed on the new web page to implement web page testing on the new web page.
[0148] See also Figure 5In some embodiments, after step S401, the web page testing method may also include but is not limited to steps S501 to S503:
[0149] Step S501, if the jump page is the target web page, take a screenshot of the page in the current web page window to obtain a screenshot of the current page;
[0150] Step S502, determining an ancestor node based on the current decision path, and obtaining a historical page screenshot of the ancestor node;
[0151] Step S503, if the current page screenshot is the same as the historical page screenshot, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path to update the original web page decision tree to obtain a target web page decision tree.
[0152] In the steps S501 to S503 shown in the embodiment of the present application, if the jump page is the target web page, a screenshot of the current page is obtained by taking a screenshot of the page of the current web page window, the ancestor node is determined based on the current decision path, and the historical page screenshot of the ancestor node is obtained; the current page screenshot is compared with the historical page screenshot to determine whether the target web page has changed, thereby preventing an infinite loop from occurring during the decision tree generation process. If the current page screenshot is the same as the historical page screenshot, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, so as to update the original web page decision tree and obtain the target web page decision, which helps to generate an efficient and non-redundant decision tree and improve the efficiency and accuracy of decision tree construction.
[0153] In step S501 of some embodiments, a decision tree is generated to generate a plug-in to monitor MutationObserver events to determine whether page elements have changed. If the MutationObserver event exceeds a set threshold (such as a preset waiting time) and has no response, a screenshot of the page in the current web page window is taken to obtain a screenshot of the current page.
[0154] Specifically, by listening to the MutationObserver event, a page change information record will be returned, including the type (element change or attribute change), the added or deleted page elements, and the changed attribute values.
[0155] Therefore, in some embodiments, if the returned page change information record indicates that the target page has not changed, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, indicating that the current decision path has ended, and the original web page decision tree is updated.
[0156] In step S502 of some embodiments, if there is an ancestor node in the current decision path, a historical page screenshot of the ancestor node is obtained.
[0157] Specifically, the OpenCV framework in Node.js can be used to take screenshots of the current page and the historical pages to determine whether the current page screenshots and the historical page screenshots have the same situation.
[0158] In step S503 of some embodiments, if the current page screenshot is identical to the historical page screenshot, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, indicating that the current decision path has ended, and the original web page decision tree is updated.
[0159] After step S503 in some embodiments, the above steps S201 to S205 are returned to be executed to implement a comprehensive decision tree construction process for the target web page.
[0160] See also Figure 6 In some embodiments, after step S501, the web page testing method may also include but is not limited to steps S601 to S603:
[0161] Step S601, if the current page screenshot is different from the historical page screenshot, obtain the child node of the current node to obtain the current child node; wherein the current child node includes page element parameters;
[0162] Step S602, merging the current child nodes based on the page element parameters to obtain the target child nodes;
[0163] Step S603: confirm the target child node as a child node of the current node to update the original web page decision tree to obtain the target web page decision tree.
[0164] In steps S601 to S603 shown in the embodiment of the present application, if the current page screenshot is different from the historical page screenshot, the current child node is obtained by obtaining the child node of the current node; wherein the current child node includes page element parameters; the current child node is merged based on the page element parameters to optimize the child node and avoid redundant nodes to obtain the target child node, and the target child node is confirmed as the child node of the current node to update the original web page decision tree, optimize the decision tree structure, and obtain the target web page decision tree, which helps to improve the accuracy of building the web page decision tree.
[0165] In step S601 of some embodiments, if the current node has child nodes, the current child nodes are obtained, wherein each current child node includes a page element parameter, namely, a UUID.
[0166] In step S602 of some embodiments, based on the UUID of the page element, if it is a page element of a scroll event type, the page element parameters also include a scroll distance (scrollTop).
[0167] In step S602 of some embodiments, the current child nodes are merged according to the page element parameters (UUID and scrolling distance (if it is a page element of the scrolling event type)); if the page element parameters are the same, they are merged to obtain the target child node; specifically, the path information of one of the current child nodes can be retained and the redundant information of the other current child node can be discarded, but this is not limited to this.
[0168] It should be noted that if the UUID is the same but the scroll distance (scrollTop) is different, they cannot be merged. For example, the same button at the top and bottom of the page is regarded as a different node.
[0169] In step S603 of some embodiments, after the current sub-nodes are merged, a target sub-node is obtained, and the target sub-node is confirmed as a sub-node of the current node to update the original web page decision tree.
[0170] The specific embodiment illustrated in the above steps S601 to S603 can determine whether the next level in the original web page decision tree is likely to contain previously existing nodes (for example, new page elements that appear in the current web page window after executing the candidate execution element), and exclude the nodes that already exist in the previous level.
[0171] After step S603 in some embodiments, the above steps S202 to S205 are returned to be executed to implement a comprehensive decision tree construction process for the target web page.
[0172] In some embodiments, step S104 may include but is not limited to the following steps:
[0173] Obtain a root node and at least one leaf node of the target web page decision tree;
[0174] Obtain a path from the root node to each leaf node to obtain at least one web page test path.
[0175] It should be noted that the execution process included in the web page test path constitutes a test case, and the web page test of the target web page can be implemented by executing the web page test path.
[0176] By using the embodiment illustrated in step S104, a web page test path is generated based on the target web page decision tree, which can ensure that the test can cover all key elements and interaction scenarios in the web page, which helps to improve the comprehensiveness and accuracy of the test, reduce the possibility of omissions and errors, and improve the efficiency and accuracy of web page testing.
[0177] In addition, the web page test path generated by the target web page decision tree can also realize automated testing, which helps to reduce testing costs and improve testing quality.
[0178] See also Figure 7 In some embodiments, step S105 may include but is not limited to steps S701 to S703:
[0179] Step S701, determining the test execution nodes and the node execution order according to the web page test path;
[0180] Step S702, screening elements from the target web page based on the test execution node to obtain candidate page elements;
[0181] Step S703: execute the candidate page elements based on the node execution order to obtain web page test feedback information.
[0182] Steps S701 to S703 shown in the embodiment of the present application determine the test execution nodes and the node execution order according to the web page test path, thereby accurately screening out the elements to be tested from the target web page and executing the test in an orderly manner, thereby ensuring that the web page test process is efficient and comprehensive, and effectively collecting detailed web page test feedback information, so as to provide support for the evaluation and optimization of web page quality.
[0183] In step S701 of some embodiments, the web page test path reflects the test execution plan. By parsing the web page test path, the test execution nodes and node execution order can be obtained, which can avoid repeated tests and missed tests, and help improve test efficiency.
[0184] In step S702 of some embodiments, the corresponding page element is found from the target web page according to the test execution node in the web page test path. Specifically, the test execution node is the UUID of the page element, and the corresponding page element needs to be found according to the UUID, which is conducive to quickly launching page testing and improving the efficiency of web page testing.
[0185] In step S703 of some embodiments, the candidate page elements are actually operated according to a specific node execution order, including interactive behaviors such as clicking and scrolling. At the same time, the result of each operation and the response of the web page are recorded to obtain web page test feedback information for subsequent analysis and evaluation.
[0186] In some embodiments, web page test feedback information may include, but is not limited to: various situations encountered during the test, such as whether the operation is successful, whether the page is loaded correctly, whether there are errors or exceptions, etc. In addition, the test feedback information may also include some performance indicators, such as response time, loading speed, etc., which are used to evaluate the performance of the web page. Testers can formulate more targeted test strategies and execution plans based on this information to further improve test efficiency and quality. At the same time, developers can also optimize the code and logic of the web page based on this feedback information, thereby improving the overall performance and user experience of the web page.
[0187] In some embodiments, the web page testing method provided by the embodiments of the present application can be described in the form of a loop execution in the process of constructing nodes in the original web page decision tree to obtain the target web page decision tree, as follows:
[0188] Step 1, receiving a web page test request; wherein the web page test request includes a target web page; creating an original web page decision tree according to the web page test request, and executing step 2;
[0189] Step 2, initializing a web browsing instance based on the target web page; wherein the web browsing instance is used to browse the target web page, the web browsing instance includes a current web page window, and the current web page window is used to render the target web page, and then executing step 3;
[0190] Step 3, executing the decision tree construction process through web browsing instances and target web pages;
[0191] The decision tree construction process includes:
[0192] Step 3.1, traverse the original webpage decision tree, obtain the current decision path and the current node on the current decision path, and execute step 3.2;
[0193] Step 3.2, obtain the page elements of the target web page in the current web page window, and obtain the current page element set. If the current page element set is empty, exit step 3 and execute step 4; otherwise, execute step 3.3;
[0194] Step 3.3, based on the original web page decision tree, select candidate execution elements from the current page element set. If the candidate execution element is empty, exit step 3 and execute step 4; otherwise, execute step 3.4;
[0195] Step 3.4, obtaining execution feedback information after the candidate execution element is executed, and executing step 3.5;
[0196] Step 3.5, updating the original webpage decision tree according to the execution feedback information and the current node;
[0197] Specifically, step 3.5 may include but is not limited to the following steps:
[0198] Step 3.5.1, determining the jump webpage triggered after the candidate execution element is executed according to the execution feedback information,
[0199] If the redirected page is a new web page, proceed to step 3.5.2;
[0200] If the redirect page is the target web page, go to step 3.5.3;
[0201] Step 3.5.2, confirm the candidate execution element as the child node of the current node and the leaf node of the current decision path to update the original web page decision tree, exit step 3, and jump to step 2;
[0202] Step 3.5.3, take a screenshot of the page of the current web page window to obtain a screenshot of the current page; determine the ancestor node based on the current decision path, and obtain the historical page screenshots of the ancestor node,
[0203] If the current page screenshot is the same as the historical page screenshot, proceed to step 3.5.4;
[0204] If the current page screenshot is different from the historical page screenshot, proceed to step 3.5.5;
[0205] Step 3.5.4, confirm the candidate execution element as the child node of the current node and the leaf node of the current decision path to update the original web page decision tree, exit step 3, and jump to step 2;
[0206] Step 3.5.5, obtaining the child node of the current node to obtain the current child node; wherein the current child node includes a page element parameter; merging the current child node based on the page element parameter to obtain a target child node; confirming the target child node as a child node of the current node to update the original webpage decision tree, and executing step 3.6;
[0207] Step 3.6, repeat step 3 until no candidate execution elements can be obtained from the current page element set;
[0208] Step 4, confirming the original webpage decision tree as the target webpage decision tree;
[0209] Step 5, generating a web page test path based on the target web page decision tree;
[0210] Step 6: Perform a web page test on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test.
[0211] It should be noted that the specific implementation of steps 1 to 6 described in the form of a loop execution is basically the same as the specific implementation of steps S101 to S105, steps S201 to S206, steps S301 to S304, steps S401 to S402, steps S501 to S503, and steps S601 to S603, and will not be repeated here.
[0212] In some embodiments, in order to maintain the real-time nature of web page testing, a method of dynamically monitoring changes in the web page decision tree can be adopted. Once the target web page changes, such as adding new functions or modifying the operating process, the web page decision tree will also be updated accordingly, so that new test cases can be generated in a timely manner to ensure the comprehensiveness and accuracy of the web page testing.
[0213] See also Figure 8 The embodiment of the present application also provides a web page testing device, which can implement the above web page testing method, and the device includes:
[0214] The test request receiving module 801 is used to receive a web page test request; wherein the web page test request includes a target web page;
[0215] The original decision tree creation module 802 is used to create an original web page decision tree according to the web page test request;
[0216] A decision tree node construction module 803 is used to construct nodes of the original webpage decision tree based on the target webpage to obtain the target webpage decision tree;
[0217] A test path generation module 804 is used to generate a web page test path based on the target web page decision tree;
[0218] The target testing module 805 is used to perform a web page test on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test.
[0219] The specific implementation of the web page testing device is basically the same as the specific embodiment of the web page testing method described above, and will not be described in detail here.
[0220] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above web page testing method when executing the computer program. The electronic device can be any smart terminal including a tablet computer, a car computer, etc.
[0221] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0222] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0223] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the webpage testing method of the embodiment of this application;
[0224] Input / output interface 903, used to implement information input and output;
[0225] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0226] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0227] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0228] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the web page testing method is implemented.
[0229] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0230] The web page testing method and device, electronic device and storage medium provided by the embodiment of the present application receive a web page test request; wherein the web page test request includes a target web page, and creates an original web page decision tree according to the web page test request; based on the target web page, the original web page decision tree is constructed with nodes to obtain a target web page decision tree, which can efficiently and logically sort out various functions in the target web page, realize automatic generation of the decision tree, and ensure the comprehensiveness and accuracy of the web page decision tree. Then, a web page test path is generated based on the target web page decision tree, and a web page test is performed on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test, effectively improving the efficiency and quality of the web page test.
[0231] In addition, in order to maintain the real-time nature of web page testing, the changes in the web page decision tree can be dynamically monitored. Once the target web page changes, such as adding new functions or modifying the operation process, the web page decision tree will be updated accordingly, so that new test cases can be generated in time to ensure the comprehensiveness and accuracy of the web page test.
[0232] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0233] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0234] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0235] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0236] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0237] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0238] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0239] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0240] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0241] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0242] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A web page testing method, characterized in that: The method comprises: Receiving a web page test request; wherein the web page test request includes a target web page; Creating an original web page decision tree according to the web page test request; Based on the target web page, nodes of the original web page decision tree are constructed to obtain a target web page decision tree; Generate a webpage test path based on the target webpage decision tree; A web page test is performed on the target web page based on the web page test path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or has failed the web page test.
2. The method according to claim 1, characterized in that The step of constructing nodes of the original webpage decision tree based on the target webpage to obtain the target webpage decision tree includes: Initializing a web page browsing instance based on the target web page; wherein the web page browsing instance is used to browse the target web page, the web page browsing instance includes a current web page window, and the current web page window is used to render the target web page; Performing a forward traversal on the original webpage decision tree to obtain a current decision path and a current node located on the current decision path; Obtaining page elements of the target web page in the current web page window to obtain a current page element set; Filtering candidate execution elements from the current page element set based on the original web page decision tree; Obtaining execution feedback information after the candidate execution element is executed; The original webpage decision tree is updated according to the execution feedback information and the current node to obtain the target webpage decision tree.
3. The method according to claim 2, characterized in that The updating of the original webpage decision tree according to the execution feedback information and the current node to obtain the target webpage decision tree includes: Determine, according to the execution feedback information, a jump webpage triggered after the candidate execution element is executed; If the jump page is a new web page, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path, so as to update the original web page decision tree and obtain the target web page decision tree.
4. The method according to claim 3, characterized in that: After determining the jump webpage triggered after the candidate execution element is executed according to the execution feedback information, the method further includes: If the jump page is the target web page, taking a screenshot of the page of the current web page window to obtain a screenshot of the current page; Determine an ancestor node based on the current decision path, and obtain a historical page screenshot of the ancestor node; If the current page screenshot is the same as the historical page screenshot, the candidate execution element is confirmed as a child node of the current node and a leaf node of the current decision path to update the original web page decision tree to obtain the target web page decision tree.
5. The method according to claim 4, characterized in that After determining the ancestor node based on the current decision path and obtaining the historical page screenshot of the ancestor node, the method further includes: If the current page screenshot is different from the historical page screenshot, obtaining the child node of the current node to obtain the current child node; wherein the current child node includes page element parameters; Based on the page element parameters, the current sub-nodes are merged to obtain a target sub-node; The target child node is confirmed as a child node of the current node to update the original webpage decision tree to obtain the target webpage decision tree.
6. The method according to any one of claims 2 to 5, characterized in that: The step of obtaining page elements of the target web page in the current web page window to obtain a current page element set includes: Determining rendering position information of the target web page based on the current web page window; Determining page rendering content of the target webpage based on the rendering position information; Extracting elements from the page rendering content through a preset decision tree generation plug-in to obtain original page elements; The original page elements are screened based on preset element types to obtain a current page element set; wherein the preset element types include click event element types and scroll event element types.
7. The method according to any one of claims 1 to 6, characterized in that: The performing a web page test on the target web page based on the web page test path to obtain web page test feedback information includes: Determine the test execution nodes and the node execution order according to the web page test path; Screening elements from the target web page based on the test execution node to obtain candidate page elements; The candidate page elements are executed based on the node execution order to obtain the web page test feedback information.
8. A web page testing device, characterized in that: The device comprises: A test request receiving module, used to receive a web page test request; wherein the web page test request includes a target web page; An original decision tree creation module, used to create an original web page decision tree according to the web page test request; A decision tree node construction module, used to construct nodes of the original webpage decision tree based on the target webpage to obtain a target webpage decision tree; A test path generation module, used to generate a web page test path based on the target web page decision tree; The target testing module is used to perform a web page test on the target web page based on the web page testing path to obtain web page test feedback information; wherein the web page test feedback information is used to indicate whether the target web page has passed the web page test or failed the web page test.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Multi-webpage application automatic execution method and system based on virtual browser isolation
CN121561212A