Web system function analysis method and system, electronic equipment and storage medium

Through headless browsers and browser APIs, the web system function points and analysis selector paths are automatically identified, which solves the problem of difficulty in identifying function points and inaccurate path analysis in the web system function analysis, and realizes efficient automated execution and intelligent application, improving user experience and reducing maintenance costs.

CN119621537APending Publication Date: 2025-03-14DMAI (GUANGZHOU) CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411466189.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The prior art has problems in the functional analysis of web system, such as difficulty in identifying functional points, inaccurate path analysis, low automation execution efficiency, and limited application of agents.

Method used

Through headless browsers and browser APIs, we automatically identify the functional points of the web system and analyze the selector paths to achieve automated execution of the functions of the web system. The specific steps include inputting the URL of the home page of the target web system into the headless browser, obtaining the HTML source code, parsing and generating the DOM structure tree, extracting HTML elements and using the selector to generate a click subtask, performing the click subtask and judging URL changes to identify functional points.

Benefits of technology

It realizes automatic identification and path analysis of the functional points of the Web system, improves the efficiency of automated testing, reduces manual intervention and maintenance costs, expands the scope of application of the agent in the Web system, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621537A_ABST
    Figure CN119621537A_ABST
Patent Text Reader

Abstract

The invention discloses a Web system function analysis method and system, electronic equipment and a storage medium, and the method comprises the following steps: inputting a URL (Uniform Resource Locator) of a home page in a target Web system into a headless browser, and opening the home page by the URL; acquiring an HTML source code of the home page by using a browser API; analyzing the HTML source code of the home page to generate a DOM structure tree of the home page; extracting all HTML (Hypertext Markup Language) elements from the DOM (Document Object Model) structure tree of the home page, and generating a click subtask by utilizing a selector; calling a headless browser to execute the click subtask, judging whether the URL after the click subtask is executed is the same as the URL before the click subtask is executed, and generating a new DOM (Document Object Model) structure tree; if the URL changes, it is considered that the HTML element clicked by executing the subtask this time is a new function point; if the URL does not change, judging a DOM (Document Object Model) structure tree; and all the clickable function points are detected. According to the invention, the function points in the Web system can be automatically identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and more specifically to a Web system function analysis method, system, electronic equipment and storage medium. Background Art

[0002] With the rapid development of information technology, Web systems have become an indispensable part of people's daily work and life. With its rich functions, convenient operation and wide application fields, Web systems provide users with great convenience. However, with the increasing complexity of Web applications, users are faced with problems such as numerous functional points and unclear operation paths during use, which not only increases the user's learning cost, but also affects the user experience.

[0003] In existing technologies, the functional analysis of Web systems mainly relies on manual operation and empirical judgment, which is not only inefficient but also prone to errors. In addition, for programs such as automated testing and intelligent agents, it is difficult to achieve automated operation and testing of Web systems due to the lack of effective function point identification and path analysis mechanisms.

[0004] Specifically, the problems existing in the prior art mainly include:

[0005] 1. Difficulty in identifying function points: The function points of a Web system are usually presented through interface elements such as buttons and links. However, the identification of these elements often relies on specific identifiers or attributes, which may vary depending on the developer's habits or design standards, making it difficult for automated tools to accurately identify them.

[0006] 2. Imprecise path analysis: Even if a function point is identified, it is still a challenge to determine the operation path to reach that function point. Different users may reach the same function point through different operation sequences, and existing technologies have difficulty in flexibly handling this diversity.

[0007] 3. Low efficiency of automated execution: Due to the lack of an effective automated execution mechanism, existing automated testing tools often require a large number of preset scripts and manual intervention when executing Web system functions, which limits the widespread application of automated testing.

[0008] 4. Limited application of intelligent agents: When performing automated tasks, programs such as intelligent agents need to have a deep understanding of the functions and operation paths of the Web system. However, existing technologies cannot provide sufficient support, which limits the application of intelligent agents in Web systems. Summary of the invention

[0009] In view of this, the present invention provides a Web system function analysis method, system, electronic device and storage medium, which aim to accurately identify the functional points of the Web system through automation technology, and analyze the selector paths to reach these functional points, so as to realize the automated execution of the Web system functions, improve efficiency, reduce costs, and expand the application scope of programs such as intelligent agents in the Web system.

[0010] In order to achieve the above object, the present invention adopts the following technical solution:

[0011] First, the present invention discloses a method for analyzing Web system functions, comprising the following steps:

[0012] Enter the URL of the home page of the target Web system into the headless browser and open the home page of the target Web system according to the entered URL;

[0013] Use the browser API to obtain the HTML source code of the target Web system's home page;

[0014] Parse the HTML source code of the home page to generate a DOM structure tree of the home page, wherein the DOM structure tree of the home page is used to represent the page structure of the home page;

[0015] Extract all HTML elements from the home page DOM structure tree, and generate click subtasks using selectors;

[0016] Calling a headless browser to execute the click subtask, after executing the click subtask, determining whether the URL after executing the click subtask is the same as the URL before executing the click subtask, and generating a new DOM structure tree;

[0017] If the URL changes, it is considered that the HTML element clicked by the current subtask is a new function point;

[0018] If the URL has not changed, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task. If the DOM structures are different, the HTML element clicked by the subtask in this execution is a new function point;

[0019] The new DOM structure tree is analyzed and detected recursively until all clickable function points are detected.

[0020] Furthermore, in the above method, the click subtask is generated by using a selector, which specifically includes the following steps:

[0021] Use the selector to select any HTML element and generate a click task for the selected HTML element.

[0022] Furthermore, the above method also includes using the API of the headless browser to obtain page screenshots before and after executing the click subtask process, and by judging whether the page screenshot before executing the click subtask is the same as the page screenshot after executing the click subtask, it is judged whether the HTML element clicked in this execution of the subtask is a new function point.

[0023] Secondly, another aspect of the present invention discloses a Web system function analysis system, including a headless browser module, which is used to open a Web page in a target Web system according to an input URL;

[0024] The data acquisition module is used to obtain the HTML source code of the web page using the browser API;

[0025] DOM tree generator, used to parse HTML source code using DOM tree parsing technology to generate a DOM tree representing the page structure;

[0026] The path selection module is used to extract all HTML elements from the DOM structure tree and generate click subtasks using selectors;

[0027] The subtask execution module calls the headless browser to execute the click subtask, and after executing the click subtask, determines whether the URL after executing the click subtask is the same as the URL before executing, and generates a new DOM structure tree;

[0028] Function point judgment module: if the URL changes, it considers that the HTML element clicked by the current subtask is a new function point;

[0029] If the URL has not changed, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task. If they are different, the HTML element clicked by the subtask in this execution is a new function point.

[0030] The new DOM structure tree is analyzed and detected recursively until all clickable function points are detected.

[0031] Preferably, in the path execution module, a click subtask is generated by using a selector, which specifically includes the following steps:

[0032] Use the selector to select any HTML element and generate a click task for the selected HTML element.

[0033] Preferably, the above-mentioned system also includes a manual review module, which uses the API of the headless browser to obtain page screenshots before and after executing the click subtask process, and determines whether the page screenshot before executing the click subtask is the same as the page screenshot after executing the click subtask, and determines whether the HTML element clicked in this execution of the subtask is a new function point.

[0034] The third aspect of the present invention further discloses an electronic device, including a computer system, which can implement any one of the Web system function analysis methods described in the present invention when executed.

[0035] In addition, the present invention also discloses a computer medium, wherein the computer medium is used to store a computer program, and the computer program, when executed, can implement any one of the Web system function analysis methods of the present invention.

[0036] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a Web system function analysis method, system, electronic device and storage medium, which have the following beneficial effects:

[0037] 1. Automatic function point identification: The present invention automatically identifies function points in the Web system through advanced algorithms, reduces manual intervention, and greatly improves the accuracy and efficiency of identification.

[0038] 2. Improve the efficiency of automated testing: Through automated function point identification and path analysis, the present invention significantly improves the efficiency of automated testing and reduces the reliance on manual scripts.

[0039] 3. Enhance user experience: By automating the execution of Web system functions, users can access required functions more quickly, improving the user experience.

[0040] 4. Expanding the application of intelligent agents: The present invention provides programs such as intelligent agents with the ability to deeply understand and operate Web systems, expanding their application scope in automation tasks.

[0041] 5. Reduce maintenance costs: Since the need for manual operation and script writing is reduced, the present invention helps to reduce the cost of long-term maintenance of the Web system.

[0042] 6. Strong adaptability: The method and system of the present invention can adapt to Web systems of different types and sizes, and have good versatility and scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0044] Figure 1 This is a schematic diagram of the overall steps of the Web system function analysis method provided by the present invention.

[0045] Figure 2 The present invention provides another embodiment of the method for analyzing the function of a Web system in accordance with another embodiment of the present invention. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] The embodiment of the present invention discloses a method for analyzing the function of a Web system, which can automatically analyze the function points of a Web system, such as Figure 1 As shown, the specific technical solution is as follows:

[0048] A method for analyzing Web system functions, comprising the following steps:

[0049] Enter the URL of the home page of the target Web system into the headless browser and open the home page of the target Web system according to the entered URL;

[0050] Use the browser API to obtain the HTML source code of the target Web system's home page;

[0051] Parse the HTML source code of the home page to generate a DOM structure tree of the home page, wherein the DOM structure tree of the home page is used to represent the page structure of the home page;

[0052] Extract all HTML elements from the home page DOM structure tree (here refers to all HTML elements in the home page, including the original HTML in the hidden state), and use the selector to generate a click subtask;

[0053] Calling a headless browser to execute the click subtask, after executing the click subtask, determining whether the URL after executing the click subtask is the same as the URL before executing the click subtask, and generating a new DOM structure tree;

[0054] If the URL changes, it is considered that the HTML element clicked by the current subtask is a new function point;

[0055] If the URL has not changed, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task. If the DOM structures are different, the HTML element clicked by the subtask in this execution is a new function point;

[0056] The new DOM structure tree is analyzed and detected recursively until all clickable function points are detected.

[0057] In the above method, a selector is used to generate a click subtask, which specifically includes: using a selector to select any HTML element and generating a click task for the selected HTML element. In this step, a selector such as an id selector can be used to select any element, and then the API of the headless browser (or a self-packaged js program) is called to execute the click task for the selected HTML element. Whether the clicked HTML element is a clickable function point is determined by whether the URL after executing the click task is the same as the URL before execution, and a new DOM structure tree is generated after the click. If the URLs are the same, whether it is a clickable function point is determined based on whether the DOM structure tree changes before and after execution.

[0058] Preferably, the above method also includes using the API of the headless browser to obtain page screenshots before and after executing the click subtask process, and judging whether the page screenshot before executing the click subtask is the same as the page screenshot after executing the click subtask, to judge whether the HTML element clicked in this execution of the subtask is a new function point.

[0059] In the above method, a function tree of each level in the Web system can also be generated according to the finally obtained clickable function points.

[0060] Combine the following Figure 2 Another step flow chart shown in the figure further analyzes the method steps of the present invention. The Web system function analysis method of the present invention may include the following technical points:

[0061] 1. Enter the URL and set the function level: The user enters the URL corresponding to the web system page to be analyzed and sets the maximum function level of the analysis. This function level setting allows the user to select the appropriate analysis depth according to the different analysis requirements of different web systems. Specifically, the user can control the analysis level by setting the number of recursions to ensure that the analysis process is both comprehensive and efficient.

[0062] 2. Use a headless browser to open a web system: The program uses headless browser technology to open the target web system according to the input URL. A headless browser simulates the behavior of a regular browser, but does not need to display a user interface, making it suitable for automated testing and analysis.

[0063] 3. Get Web page data: Through the browser API, the program obtains the URL and HTML source code of the Web page. These data provide the basis for subsequent function point analysis.

[0064] 4. Generate DOM structure tree: parse HTML elements to generate DOM structure tree. DOM structure tree is a tree data structure used to represent the HTML element structure of a page. The attribute values ​​of DOM structure tree include the tag, id attribute, class attribute, hidden attribute, CSS selector, text content, and child nodes of HTML elements. From the DOM structure tree, the program extracts all text nodes with non-whitespace characters and the corresponding selector paths.

[0065] 5. Subtask generation and execution: The extracted selector paths are used as subtasks, and the program calls the headless browser to execute these paths. During the execution process, the URL, HTML, and CSS styles corresponding to the HTML elements are obtained again, and a new DOM structure tree is generated.

[0066] 6. Comparison of URL and DOM structure tree and identification of function points: Compare the URL of the parent task and the subtask to see if they have changed. If they have changed, the element clicked this time is considered to be a new function point. Extract the text node and selector path from the subtask DOM structure tree to generate a new subtask. Otherwise, compare the DOM structure tree.

[0067] Compare the newly generated DOM structure tree with the DOM structure tree of the parent task. The comparison method is: the structures of the two trees are the same, that is, all attribute values ​​of the same-level nodes of the two trees are consistent. If the two trees are the same, it means that the execution of the selector path does not trigger any function, the corresponding text node is not clickable, and the text node and selector path are no longer extracted from the DOM structure tree to generate subtasks. If the new and old DOM structures are different in structure, further remove the text content in the DOM structure and compare it with other DOM structures without text content in this task. If the DOM structure after removing the text is still different, it is considered that the clicked element is a new function point, and a new text node and selector path are extracted from the new DOM structure tree and continued to be executed as a new subtask; if there is an identical one, it is considered that the clicked element is the same as the original function point, because the text content will change due to the dynamic page, but it is not actually a new function.

[0068] 7. Function tree generation: After executing all tasks, the program will eventually generate a function tree at each level and the corresponding page screenshots. The function tree shows all clickable function points and their paths of the Web system in a hierarchical structure, providing a clear view for automated testing and agent operations.

[0069] Manual review: Manual review is performed against the function tree and page screenshots to reduce errors and improve accuracy.

[0070] Based on the same inventive principle as the analysis method, the present invention discloses a Web system function analysis system on the other hand, including a headless browser module, which is used to open a Web page in a target Web system according to an input URL; a data acquisition module, which is used to obtain the HTML source code of the Web page by using the browser API; a DOM structure tree generator, which is used to parse the HTML source code by using the DOM tree parsing technology to generate a DOM structure tree representing the page structure; a path selection module, which is used to extract all HTML elements from the DOM structure tree and generate a click subtask by using a selector; a subtask execution module, which calls the headless browser to execute the click subtask, and after executing the click subtask, determines whether the URL after executing the click subtask is the same as the URL before execution, and generates a new DOM structure tree; a function point judgment module, which considers that the HTML element clicked by the current execution of the subtask is a new function point if the URL changes; if the URL does not change, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task, if they are not the same, the HTML element clicked by the current execution of the subtask is a new function point; and the new DOM structure tree is analyzed and detected in a recursive manner until all clickable function points are detected.

[0071] Furthermore, the above system also includes a manual review module, which uses the API of the headless browser to obtain page screenshots before and after executing the click subtask process, and determines whether the page screenshot before executing the click subtask is the same as the page screenshot after executing the click subtask, to determine whether the HTML element clicked in this subtask execution is a new function point.

[0072] In addition, the present invention also discloses an electronic device, including a computer system, and the computer system can implement any one of the Web system function analysis methods of the present invention when executed.

[0073] The Web system function analysis method of the present invention can be implemented in the form of a computer program, and the computer program is stored in various forms of computer media, such as a computer hard disk or other storage media.

[0074] The technical implementation of the present invention involves the following key components:

[0075] Headless browser: A special browser instance designed to perform automated tasks without a user interface.

[0076] DOM structure tree generator: a parsing tool used to generate custom DOM structure tree data from the CSS styles corresponding to the HTML elements of a page.

[0077] Path executor: An executor that executes selector paths in a headless browser and captures the results.

[0078] Comparator: used to compare the URL difference before and after execution, the difference of DOM structure tree before and after execution, and the difference between the DOM structure tree without text and other DOM structure trees without text, so as to identify the function points.

[0079] Functional Tree Builder: A building tool used to generate a functional tree from analysis results.

[0080] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0081] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for analyzing Web system functions, characterized in that: The following steps are involved: Enter the URL of the home page of the target Web system into the headless browser and open the home page of the target Web system according to the entered URL; Use the browser API to obtain the HTML source code of the target Web system's home page; Parse the HTML source code of the home page to generate a DOM structure tree of the home page, wherein the DOM structure tree of the home page is used to represent the page structure of the home page; Extract all HTML elements from the home page DOM structure tree, and generate click subtasks using selectors; Calling a headless browser to execute the click subtask, after executing the click subtask, determining whether the URL after executing the click subtask is the same as the URL before executing the click subtask, and generating a new DOM structure tree; If the URL changes, the HTML element clicked by the subtask is considered to be a new function point; If the URL has not changed, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task. If the DOM structure is different, the HTML element clicked by the subtask in this execution is a new function point; The new DOM structure tree is analyzed and detected recursively until all clickable function points are detected.

2. A Web system function analysis method according to claim 1, characterized in that: Using the selector to generate a click subtask includes the following steps: Use the selector to select any HTML element and generate a click task for the selected HTML element.

3. A Web system function analysis method according to claim 1, characterized in that: It also includes using the API of the headless browser to obtain page screenshots before and after executing the click subtask process, and judging whether the page screenshots before executing the click subtask are the same as the page screenshots after executing the click subtask, to judge whether the HTML element clicked in this subtask execution is a new function point.

4. A Web system function analysis system, characterized in that: include, A headless browser module, which is used to open a web page in the target web system according to the input URL; The data acquisition module is used to obtain the HTML source code of the web page using the browser API; DOM structure tree generator, used to parse HTML source code using DOM tree parsing technology to generate a DOM structure tree representing the page structure; The path selection module is used to extract all HTML elements from the DOM structure tree and generate click subtasks using selectors; The subtask execution module calls the headless browser to execute the click subtask, and after executing the click subtask, determines whether the URL after executing the click subtask is the same as the URL before executing, and generates a new DOM structure tree; Function point judgment module: if the URL changes, it considers that the HTML element clicked by the current subtask is a new function point; If the URL has not changed, the newly generated DOM structure tree is compared with the DOM structure tree of the previous task. If they are different, the HTML element clicked by the subtask in this execution is a new function point. The new DOM structure tree is analyzed and detected recursively until all clickable function points are detected.

5. A Web system function analysis system according to claim 4, characterized in that: In the path execution module, a click subtask is generated by using a selector, which specifically includes the following steps: Use the selector to select any HTML element and generate a click task for the selected HTML element.

6. A Web system function analysis system according to claim 4, characterized in that: It also includes a manual review module, which uses the API of the headless browser to obtain page screenshots before and after executing the click subtask, and determines whether the page screenshots before executing the click subtask are the same as the page screenshots after executing the click subtask, to determine whether the HTML element clicked in this subtask is a new function point.

7. An electronic device, characterized in that: It includes a computer system, which can implement the Web system function analysis method described in any one of claims 1 to 3 when executed.

8. A computer medium, characterized in that The computer medium is used to store a computer program, and the computer program, when executed, can implement the Web system function analysis method described in any one of claims 1 to 3.