A method for visualizing multithreaded web access
By designing a visual, multi-threaded webpage access method, utilizing Task multi-threading and the .NET HttpWebRequest interface, the problem of automated access to multiple websites was solved, achieving an efficient and visual webpage access process, meeting agile development requirements, and improving user experience and device resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI HENGWEI INTELLIGENT TECH CO LTD
- Filing Date
- 2023-02-22
- Publication Date
- 2026-06-12
AI Technical Summary
Existing tools cannot automate multi-website and multi-threaded concurrent web page access, resulting in a large amount of manual work, frequent logging errors, interface freezes, and poor environmental adaptability, which cannot meet the needs of agile development.
Design a visual multi-threaded webpage access method that utilizes Task multi-threading to allocate and process website access, combines the .NET HttpWebRequest interface and asynchronous resource management, displays access progress in real time, and supports special access identifier processing and result recording.
It enables fully automated, multi-threaded concurrent web page access, reduces manual workload, improves the visualization and operability of the access process, supports agile development, avoids interface freezes, and improves device resource utilization.
Smart Images

Figure CN116304456B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of website testing, specifically a method for visualizing multi-threaded webpage access. Background Technology
[0002] During product functional testing, it's necessary to collect access blocking data from hundreds of thousands or even millions of fraudulent websites. Inevitably, the following issues arise: the sheer number of websites makes manual access via browsers impossible; access data must be manually recorded, which is prone to errors or loss; some websites require multiple loops of access, resulting in repetitive and massive workloads; and the large number of parameters makes execution inconvenient. Current tools can only perform stress testing on single websites, unable to handle multiple websites, and cannot monitor or display access progress and status in real time. Furthermore, the inability to perform operations during execution can cause the interface to freeze, resulting in a poor user experience. Additionally, stress testing requires specialized equipment or specific environment dependencies, leading to poor environmental adaptability and ease of use.
[0003] Customers have different specific access requirements for different websites, such as only accessing the root directory of the current website, etc. Currently, there are no tools that can automatically identify and handle these requirements. Developing testing tools using older multi-threading technologies is labor-intensive and cannot meet the needs of agile development. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a fully automatic, multi-threaded concurrent visual web page access method, and the visualization of the method meets the needs of agile development.
[0005] To achieve the above objectives, a visual multi-threaded webpage access method is designed, as follows: Step S101: Read the list of websites to be accessed; Step S201: Obtain the parameters for the websites selected by the tool; Step S301: Enter the website access module, obtain the number of websites to be accessed, and allocate the processing batches using Task multi-threading; Step S401: Obtain the website string and access identifier; Step S501: Determine whether the current website carries a special access identifier; Step S601: If it carries a special access identifier field, process the accessed website string as a temporary new URL to be accessed. Website path; Step S701: Call the .NET HttpWebRequest interface to start website access; Step S702: During website access, allocate asynchronous resources to the front-end visualization; Step S801: Obtain the website access response; Step S901: Record the response status code and access time together; Step S1001: Determine if the website in the current access batch is the last website. If yes, continue execution; if no, jump to step S301; Step S1101: Release the multi-threaded resources allocated by the Task and inform other computing and display components: This access has ended.
[0006] The present invention also has the following preferred technical solutions:
[0007] 1. The website access parameters in step S201 include the number of loop accesses, the website access timeout time, and the number of access threads.
[0008] 2. In step S701, the access function is limited by the conditions selected by the user, including whether to jump and the timeout threshold.
[0009] 3. It also includes step S1201: obtaining the output selections selected by the user on the visual interface, and outputting the operation log and access results.
[0010] Compared with the prior art, the advantages of this invention are:
[0011] 1. By automating the tedious access process, it frees up manpower and saves time; and by making the process more visual, the selection of conditions and input of parameters are more convenient, and the progress of the program is clear at a glance. With just a simple understanding of the operation steps, it is possible to verify and output reports on access to hundreds of thousands or even millions of websites with different formats.
[0012] 2. It can customize access processing under different conditions, output access results on demand, and display them in a personalized manner;
[0013] 3. Full website access: This feature allows for the querying of access records for each website, ensuring the completeness and accuracy of the results.
[0014] 4. Visualization aligns with the characteristics of agile product development, enabling the rapid development of verification tools adapted to new product features and the customization of test conditions. The software embeds the necessary dependency libraries, eliminating the need for users to select dedicated equipment, making it simpler to use and providing a better experience.
[0015] 5. It solves the problem of UI freezing caused by large-scale calculation operations in traditional WinForms visual projects, and allows real-time monitoring of website access progress and status, without causing the tool to crash abnormally while being operated;
[0016] 6. Utilizing .NET's Task multithreading replaces the traditional thread pool, better transmitting thread processing status to various components, making better use of device resources, and preventing the device from malfunctioning due to excessive resource consumption; it also ensures the orderly processing of threads, accessing them sequentially according to the imported list; thus reducing the workload of development. Attached Figure Description
[0017] Figure 1 This is the overall flowchart of the present invention. Detailed Implementation
[0018] The invention will be further described below with reference to the accompanying drawings. The structure and principle of the invention are very clear to those skilled in the art. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention.
[0019] This invention's visual access tool uses a WinForms framework for front-end visualization. Based on an imported list of hundreds of thousands to millions of websites in various formats (each website carries its own unique processing field identifier), it uses a multi-threaded Task class to sequentially simulate website access operations using the .NET framework's HttpWebRequest interface. The access results are determined based on set access counts, timeouts, and access outcomes. Asynchronous processing eliminates the issue of program interface freezes during access. The overall access progress and real-time access status of each website are displayed on the front-end in real time. After all websites have been accessed, the results are categorized, statistically analyzed, and output using user-defined output conditions.
[0020] WinForm is the name for Windows Forms in the .NET development platform. It can be used to design forms and visual controls to create rich Windows-based applications. The Task class is a wrapper around the original ThreadPool. Task has strong control and extensibility, and far surpasses Thread and ThreadPool in terms of thread continuation, blocking, cancellation, and timeout. .NET is a free and open-source development platform for building various applications. HttpWebRequest is a class provided by C# native syntax that fully encapsulates the HTTP protocol and can implement HTTP requests of any type.
[0021] like Figure 1 As shown, the specific steps of the present invention are as follows:
[0022] Step S101: Read the list of websites that need to be accessed.
[0023] Step S201: Obtain the parameters of the selected website accessed by the tool, such as the number of loop accesses, the website access timeout, and the number of access threads.
[0024] Step S301: Enter the website access module, obtain the number of websites to be accessed, and use Task multi-threading to allocate batches for processing. According to the number of threads selected by the user, the total number of websites is divided into batches of subtasks according to the defined number of threads, and then processed in batches.
[0025] Step S401: Obtain the website's string and access identifier.
[0026] Step S501: Determine whether the current website carries a special access identifier.
[0027] Step S601: If a special access identifier field is carried, the accessed website is processed as a temporary new website path to be accessed. Specifically, the obtained website string is first subjected to regular expression matching or fuzzy matching for special processing conditions (e.g., if accessing an HTTP website fails, try accessing an HTTPS website; for websites above the second-level root directory, only the second-level root domain is accessed), and then escaped, truncated, and concatenated.
[0028] Step S701: Call the .NET HttpWebRequest interface to start website access. Based on the conditions selected by the user, restrict the access function, such as whether to redirect, timeout threshold, etc.
[0029] Step S702: During website access, asynchronous resources are allocated to the front-end visualization to display the access progress and status in real time, ensuring program operability. Specifically, the .NET beginInvoke asynchronous execution delegate is used to synchronize the data access progress between the access thread and the front-end visualization thread.
[0030] Step S801: Obtain the response from the website access.
[0031] Step S901: Record the response status code along with the access time.
[0032] Step S1001: Determine whether the website in the current access batch is the last website. If yes, continue execution; otherwise, skip to step S301.
[0033] Step S1101: Release the multi-threaded resources allocated by the Task and inform other computing and display components that this access has ended.
[0034] Step S1201: Obtain the output options selected by the user in the visualization interface, and output the operation log and access results (such as the status code of the accessed website, response time, access success rate, etc.).
[0035] Step S1301: Program ends.
[0036] The above description is merely a specific embodiment of the invention, but the scope of protection of the invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the technical scope disclosed in the invention, based on the technical solutions and novel concepts of the invention, should be covered within the scope of protection of the invention.
Claims
1. A visual multi-threaded webpage access method, characterized in that... The specific method is as follows: Step S101: Read the list of websites to be accessed; Step S201: Obtain the parameters for the websites accessed by the selected tools; Step S301: Enter the website access module, obtain the number of websites to be accessed, and the batches to be processed using Task multi-threading. Based on the number of threads selected by the user, divide the total number of websites into batches of subtasks according to the defined number of threads, and then process them in batches. Step S401: Obtain the website's string and access identifier; Step S501: Determine whether the current website carries a special access identifier; Step S601: If a special access identifier field is carried, the accessed website is processed as a temporary new website path to be accessed. The obtained website string is first processed by regular expression matching or fuzzy matching, and then escaped, truncated and concatenated. Step S701: Call the .NET HttpWebRequest interface to start website access. In step S701, the access function is limited by the conditions selected by the user, including whether to redirect and timeout threshold. Step S702: During the website access process, allocate asynchronous resources to the front-end visualization; Step S801: Obtain the website access response; Step S901: Record the response status code along with the access time; Step S1001: Determine whether the website in the current access batch is the last website. If yes, continue; otherwise, skip to step S301. Step S1101: Release the multi-threaded resources allocated by the Task and inform other computing and display components that this access has ended.
2. The visual multi-threaded webpage access method as described in claim 1, characterized in that... The website access parameters in step S201 include the number of loop accesses, the website access timeout time, and the number of access threads.
3. The visual multi-threaded webpage access method as described in claim 1, characterized in that... It also includes step S1201: obtaining the output selections selected by the user on the visualization interface, and outputting the operation log and access results.
Citation Information
Patent Citations
CN112052163A
CN114861101A