Web page debugging method, device, computer equipment and storage medium
By using the script debugging module to generate and monitor web page debugging on the browser side, the problems of cumbersome and low-efficiency debugging on the server side are solved, efficient and convenient web page debugging is achieved, and debugging costs and complexity are reduced.
Patent Information
- Application Number
- CN201910787611.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-26
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2039-08-26
AI Technical Summary
In the existing technology, web page debugging is cumbersome and inefficient. Especially when debugging on the server side, it is necessary to intrude the printing log in the business code, making it difficult to accurately locate the data, and the readability of large object printing is poor, which increases the complexity and cost of debugging.
By sending a web page debugging request on the browser side, receiving the blank debugging web page and script debugging module returned by the server, using the script debugging module to generate a complete debugging web page, including monitoring files to display abnormal information, and using the browser's own debugging tools. Breakpoint debugging enables you to obtain all data without code writing.
It greatly improves debugging efficiency and readability, reduces debugging difficulty and cost, allows server-side rendering code debugging on the browser side, simplifies the debugging process, and enhances the convenience of data reading.
Smart Images

Figure CN112433929B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a web page debugging method, device, computer equipment and storage medium. Background Art
[0002] During the development process, debugging is a necessary process. After debugging to ensure that there are no problems, the program or web page can be released to users for normal use. Under normal circumstances, the generation process of a web page is as follows: the terminal initiates a web page request to the server through the browser. After receiving the request, the server will return the generated HTML file to the browser. The HTML file contains the entire HTML document structure and document content. In other words, the browser receives a complete HTML file, which the browser can parse. After parsing, it can render to obtain a visual web page that the user can see. In this mode, the browser only gets the result. The browser parses what the server returns. Then there are only two situations faced by the browser. One is to receive the expected HTML page that can be loaded correctly, and the other is to fail to generate the required HTML normally due to an exception on the server. Therefore, the server generally returns a unified default exception page to the browser for parsing, such as the common 500 system exception error page.
[0003] In traditional technology, if an exception occurs and normal HTML cannot be generated, debugging is required on the server side. When debugging on the server side, you can use the log debugging solution, add the code for printing logs at the target location on the server side, and output the desired data on the server terminal; or generate these logs into log files for viewing, so as to debug. You can also add code on the server side to print out the results you want to debug through the browser console, and when the server code fails, you can output it together with the corresponding error information on the browser console, so that you can easily see the printout of the server on the browser side.
[0004] However, both of the above solutions require printing logs on the server side, which means that the code for printing logs needs to be invaded on the original business code, and sometimes it may be necessary to delete these codes, which invisibly increases the complexity of debugging. Moreover, technicians cannot always accurately locate the data they need during the printing log debugging. In other words, sometimes after printing out a part of the data, they will find that other data may be needed, and the technicians have to go back to the code to continue printing other required data. That is, they can only print what data they need temporarily, and cannot obtain all the data. Therefore, these methods cannot achieve "once and for all", which increases the complexity and complexity of debugging. In addition, the server-side log debugging method is to print the log information to the server terminal, and the printed data is in the form of a string. If you encounter some large objects, it will be printed as a long string, which is very poor in readability. Therefore, this method of debugging on the server side increases the complexity of debugging and reduces the debugging efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a web page debugging method, device, computer equipment and storage medium that can improve debugging efficiency in response to the above technical problems.
[0006] A web page debugging method, the method comprising:
[0007] Send a web page debugging request to the server;
[0008] Receiving a debugging webpage and a script debugging module returned by the server according to the webpage debugging request, wherein the script debugging module includes webpage data, a monitoring file, and a webpage fragment generation file;
[0009] Run the webpage fragment generation file to obtain the variable name of the webpage data;
[0010] Running the webpage fragment generation file to fill the webpage data into the webpage fragment code according to the variable name, generating a webpage fragment code corresponding to the target webpage, wherein the webpage fragment code includes the expected style, label and interaction information of the target webpage;
[0011] The monitoring file is run, and when it is monitored that an abnormality occurs in the process of generating the webpage fragment code corresponding to the target webpage, corresponding abnormal information is displayed on the debugging webpage.
[0012] A web page debugging device, the device comprising:
[0013] Request sending module, used to send web page debugging request to the server;
[0014] A file receiving module, used to receive debugging web page data and a script debugging module returned by the server according to the web page debugging request, wherein the script debugging module includes web page data, monitoring files and web page fragment generation files;
[0015] A web page fragment generation module is used to execute the web page fragment generation file to obtain the variable name of the web page data; execute the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate a web page fragment code corresponding to the target web page, wherein the web page fragment code includes the expected style, label and interaction information of the target web page;
[0016] The exception monitoring module is used to display corresponding exception information on the debugging web page when an exception is detected in the process of generating the web page fragment code corresponding to the target web page.
[0017] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] Send a web page debugging request to the server;
[0019] Receiving a debugging webpage and a script debugging module returned by the server according to the webpage debugging request, wherein the script debugging module includes webpage data, a monitoring file, and a webpage fragment generation file;
[0020] Run the webpage fragment generation file to obtain the variable name of the webpage data;
[0021] Running the webpage fragment generation file to fill the webpage data into the webpage fragment code according to the variable name, generating a webpage fragment code corresponding to the target webpage, wherein the webpage fragment code includes the expected style, label and interaction information of the target webpage;
[0022] The monitoring file is run, and when it is monitored that an abnormality occurs in the process of generating the webpage fragment code corresponding to the target webpage, corresponding abnormal information is displayed on the debugging webpage.
[0023] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0024] Send a web page debugging request to the server;
[0025] Receiving a debugging webpage and a script debugging module returned by the server according to the webpage debugging request, wherein the script debugging module includes webpage data, a monitoring file, and a webpage fragment generation file;
[0026] Run the webpage fragment generation file to obtain the variable name of the webpage data;
[0027] Running the webpage fragment generation file to fill the webpage data into the webpage fragment code according to the variable name, generating a webpage fragment code corresponding to the target webpage, wherein the webpage fragment code includes the expected style, label and interaction information of the target webpage;
[0028] The monitoring file is run, and when it is monitored that an abnormality occurs in the process of generating the webpage fragment code corresponding to the target webpage, corresponding abnormal information is displayed on the debugging webpage.
[0029] The above-mentioned web page debugging method, device, computer equipment and storage medium, the terminal sends a web page debugging request to the server through the browser, and receives the blank debugging web page and script debugging module returned by the server. The browser on the terminal can run the script debugging module to generate a complete debugging web page. Since the debugging web page is simulated and generated by the script debugging module, when an exception occurs during the debugging web page generation process, the monitoring file contained in the script debugging module can monitor the exception information and display it on the visualized debugging web page, and the browser's built-in debugging tool can be used to accurately breakpoint debug the exception information on the visualized debugging web page. This solution can perform breakpoint debugging on the browser to render the output code of the server, which means that the debugging process does not require writing any code, and all data can be obtained only through the browser's built-in console breakpoint debugging. Since the breakpoint debugging method is very simple, you only need to set a breakpoint on the corresponding code on the browser console, and the code will be executed to the breakpoint position. At this time, you can view any data before the breakpoint, and you can obtain the data of the abnormal position that the technician wants at any time. And the breakpoint reading data belongs to the function provided by the browser's built-in debugging console. The technician can use its ability to easily read various complex object data, with a good reading experience. At the same time, the conventional technical solution of generating debugging web pages by rendering on the server side generally only returns some error status codes when an exception occurs. The HTML page may display some specific error pages or a blank page. However, in this solution, when an exception occurs in the HTML page rendering, the error information will be directly output to the HTML page as a prompt, which is convenient for debuggers to read. This method greatly reduces the difficulty of debugging mobile browsers. The code that originally needed to perform the HTML page rendering process on the server side is executed on the browser, which is equivalent to debugging the code on both the browser and the server side only on the browser side, which greatly improves the debugging efficiency and reduces the debugging cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 An application environment diagram of a web page debugging method in an embodiment;
[0031] Figure 2A schematic diagram of a flow chart of a web page debugging method in one embodiment;
[0032] Figure 3 is a structural block diagram of a web page debugging device in one embodiment;
[0033] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0034] 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.
[0035] The web page debugging method provided by this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The terminal 102 can send a web page debugging request to the server 104 through the network, receive the debugging web page and script debugging module returned by the server 104, and execute the script debugging module to generate a complete HTML. Among them, the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented with an independent server or a server cluster composed of multiple servers.
[0036] In one embodiment, Figure 2 As shown, a web page debugging method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0037] Step 201, sending a web page debugging request to a server.
[0038] A web page debugging request refers to a request initiated by a terminal through a browser to obtain a web page to be debugged. The web page debugging request may carry link parameters, and the debug web page entered may be adjusted by changing the parameter values of the link parameters. The terminal may enter a debug web page under different debug modes by sending a web page debugging request carrying different link parameter values to the server.
[0039] In one embodiment, sending a web page debugging request to a server includes: obtaining a debugging parameter value corresponding to a debugging mode; using the debugging parameter value as a parameter value of a link parameter included in the web page debugging request; and sending a web page debugging request with the link parameter value as the debugging parameter value to the server.
[0040] Different debugging modes correspond to different debugging parameter values. When the terminal sends a web page debugging request to the server through a browser, it can enter the debugging web page in different debugging modes by changing the parameter value in the web page debugging request. Multiple link parameters can be set here, for example, two can be set, one is ip, which is used to debug the specified server, and the other is env (abbreviation of environment) for debugging the specified environment. When any of the two parameters exists and the value is correct, it means entering the debugging mode, otherwise it does not enter the debugging mode. When the two parameters appear at the same time, the ip priority is greater than env. For example, for the normal link http: / / i.xxx.com / m / index.html, specify to debug a page on a server, you can visit http: / / i.xxx.com / m / index.html? ip=10.1.2.3. Similarly, if you want to specify what environment to debug, such as the test environment, you can visit http: / / i.xxx / m / index.html? env=test.
[0041] In one embodiment, sending a web page debugging request to a server includes: when the debugging environment is a formal environment, obtaining a formal debugging parameter value corresponding to the debugging mode of the formal environment; obtaining an encrypted string corresponding to the formal debugging parameter value; using the encrypted string as a parameter value of a link parameter included in the web page debugging request; and sending the web page debugging request with the link parameter value being the encrypted string to the server.
[0042] When the debugging environment is a formal environment, more encryption measures are required to ensure that it is not easily accessed and used by non-company employees. Therefore, when the debugging environment is a formal environment, the parameter values of the debugging model corresponding to the formal environment can be obtained, that is, the formal debugging parameter values can be obtained, and the encrypted string corresponding to the formal debugging parameter values can be obtained. The encrypted string is pre-edited and defined by the technicians, and is usually used for internal development. Only after the encrypted string is verified can the debugging mode be accessed normally. Therefore, the technicians can enter the debugging mode in the formal environment by setting the link parameters to the encrypted string. For example, if you want to debug the formal environment, you can visit http: / / i.xxx.com / m / index.html?env=d80c...ad2db7f35. The env parameter value of this link is set to the corresponding encrypted string, so the browser can access the debugging webpage in the formal environment.
[0043] Step 202: Receive a debugging web page and a script debugging module returned by the server according to the web page debugging request. The script debugging module includes web page data, monitoring files, and web page fragment generation files.
[0044] Step 203: Run the web page fragment generation file to obtain the variable name of the web page data.
[0045] Step 204, run the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate the web page fragment code corresponding to the target web page. The web page fragment code includes the expected style, label and interaction information of the target web page.
[0046] Step 205, running the monitoring file, when monitoring that the process of generating the webpage snippet code corresponding to the target webpage is abnormal, displaying the corresponding abnormal information on the debugging webpage.
[0047] After receiving the web page debugging request sent by the terminal through the browser, the server will return the corresponding debugging web page and script debugging module according to the link parameters in the web page debugging request. In this web page debugging method, in debugging mode, the server will not directly return the generated HTML to be rendered to the browser as in the technical solution in the traditional technology, but will return a blank debugging web page and a script debugging module with the function of generating a web page to the browser. The script debugging module refers to a pre-edited and encapsulated code module. The script debugging module has the function of generating a web page. The script debugging module contains the web page data, monitoring files and web page fragment generation files returned by the server. The web page data is the dynamic data returned by the server. The web page data can be the processed dynamic data directly returned by the server, or it can be the dynamic data obtained from the server by the terminal after obtaining the script debugging module returned by the server and running the data acquisition file contained in the script debugging module.
[0048] In one embodiment, the script debugging module further includes a data acquisition file; the method further includes running the data acquisition file and calling a data acquisition interface to acquire web page data of the debugging web page from the server.
[0049] When the terminal runs the data acquisition file through the browser, it can call the data acquisition interface to obtain the web page data of the debugging web page from the server. The web page data is generally dynamic data. After the terminal obtains the data from the server through the browser, it can further insert the obtained data into the static HTML, so that the blank HTML returned by the server has dynamic data. The blank HTML page returned by the server can be considered as an HTML page with only a basic framework but no specific data. In the blank HTML page, the values of various variables contained are empty, and the terminal needs to run the data acquisition file through the browser to obtain data from the server to fill it.
[0050] The web page fragment generation file is mainly used to generate the web page fragment code corresponding to the target web page. Specifically, the terminal will run the web page fragment generation file through the browser to obtain the variable names of each variable contained in the web page data, and fill the web page data into the web page fragment code according to the name of the variable, so as to generate the web page fragment code corresponding to the target web page. The web page fragment code corresponding to the target web page refers to the code that can be recognized and parsed by the browser to generate a visual web page. The expected style, label and interactive information of the target web page are included in the web page fragment code, that is, the expected display of the web page data on the target web page is included in the web page fragment code, such as the position of each data in the web page data on the target web page, as well as the font size, color, display name, etc. At the same time, it also defines the interactive information on the target web page, including the display position of the interactive button, the name of the interactive button, and the jump link corresponding to the interactive button.
[0051] The monitoring file is used to monitor the abnormal situations that occur during the web page generation process, that is, to monitor the process of running the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate the web page fragment code corresponding to the target web page, that is, to monitor the generation process of the web page fragment code corresponding to the target web page. If an abnormality occurs in the generation process of the web page fragment code corresponding to the target web page, the normal target web page cannot be generated, and the monitoring file will display the abnormal information corresponding to the abnormality in the generation process on the debugging web page. Since the generation process of the web page fragment code corresponding to the target web page is executed on the browser of the terminal, when an abnormality occurs, the monitoring file can directly render the abnormal information and display the visual abnormal prompt information on the current debugging web page. The abnormal prompt information can be displayed in the form of a visual pop-up window. At the same time, the debugging web page will also display specific abnormal information, including the node where the abnormality occurs, the cause of the abnormality, and the specific problem, so that developers can quickly breakpoint debug the abnormality and quickly solve the abnormal problem.
[0052] In one embodiment, the method further includes: when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page, a success prompt message and a preview interaction button are displayed on the debugging web page; and the preview interaction button is clicked to jump from the debugging web page to the visualized target web page.
[0053] Running the monitoring file can monitor the generation process of the webpage snippet code corresponding to the target webpage. When an exception is detected, a pop-up window of the exception prompt can be directly displayed on the currently displayed debugging webpage. When no exception is detected, that is, when the generation process is monitored without exception, a success prompt message and a preview interaction button can be displayed on the debugging webpage. The success prompt message can be a success prompt pop-up window, which can be closed by clicking it, and the preview interaction button can be jumped to the visualized target webpage.
[0054] In one embodiment, the above method also includes: when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page, generating corresponding success prompt information by running the monitoring file; adding the web page snippet code corresponding to the target web page to the debugging web page to obtain the final target web page data; parsing the target web page data through the browser to generate a visual target web page, and displaying the success prompt information on the target web page.
[0055] When the monitoring file is run to monitor the generation process of the webpage snippet code corresponding to the target webpage, if no abnormality is monitored, the corresponding success prompt information can be generated by running the monitoring file, and the webpage snippet code corresponding to the target webpage can be added to the debugging webpage, so that the final target webpage data can be obtained, and the target webpage data can be parsed by the browser to generate a visual target webpage, and a success prompt information can be displayed on the target webpage. The success prompt information can be a successful prompt pop-up window, which can be closed by clicking. In other words, when the monitoring file is run and no abnormality is detected in the process of generating the webpage snippet code corresponding to the target webpage, there are at least two ways to display the visual target webpage. The first is to click the preview button to jump to the target webpage. The specific implementation method is: display the success prompt information and the preview interactive button on the debugging webpage, and click the preview interactive button to jump from the currently displayed debugging webpage to the visual target webpage. The second is to directly display the target webpage. The specific implementation method is: when no abnormality is monitored, the currently displayed debugging webpage will automatically jump to display as a visual target webpage, and display the success prompt information on the target webpage. Other display methods can also be selected, and no more examples are given here.
[0056] In one embodiment, the web page fragment generation file and monitoring file included in the script debugging module are files that are simulated and executed using JS by converting the execution process and monitoring process of the web page fragment generated by the server itself according to the JS language characteristics.
[0057] Before the server returns the script debugging module to the terminal, the server will convert the execution process and monitoring process of the web page fragment of the target web page from the code format originally written in multiple languages to the JS language format according to the characteristics of the JS language. That is, the execution code originally written in various programming languages such as JAVA, PYTHON, PHP, etc. will all be converted into the JS language format. This is a process of format unification, so that the monitoring files and web page fragment generation files contained in the script debugging module returned to the terminal can be recognized and run by the browser.
[0058] The script debugging module can be JS (JavaScript) code. Since the JavaScript returned by the server in the debugging mode needs to simulate the process of generating HTML documents, HTML is mainly composed of DOM nodes one by one, so the browser can use JS to generate these DOM nodes, and the string returned is a DOM node, or it can be said that a DOM node is a string. HTML is a string, and each DOM node in it can also be considered as a string, so you only need to splice a series of strings together to form a complete HTML file. The data in each DOM node can be passed in by passing parameters, and through a function passing parameters, the string and data are spliced together to form a new string, which is the desired DOM node. Calling this function can obtain the function of generating nodes, which will be packaged into a string for subsequent use. Write the above node generation process into the script JS, and pass the dynamic data requested from the server into the function of generating nodes, so that the node renders the required data, and you can get the HTML webpage containing dynamic data that you want to get, that is, the target webpage.
[0059] In one embodiment, after displaying the corresponding abnormal information, the method further includes: locating the abnormality according to the abnormal information to determine the corresponding abnormal node; and performing visual breakpoint debugging on the abnormal node through a debugging tool.
[0060] After receiving the script debugging module returned by the server, the terminal can simulate the HTML generation process through the script debugging module. When an exception occurs during the HTML generation process, the browser's built-in debugging tool can be used to perform fixed-point debugging on the exception corresponding to the exception information displayed on the visual debugging web page. That is, the specific abnormal node where the exception occurs can be located according to the exception information displayed on the visual debugging web page, and the abnormal node can be visually debugged at breakpoints through the browser's built-in debugging tool, so that the exception can be quickly resolved. This debugging method can debug debugging web pages in all environments, and can also enable the browser to send requests to access debugging web pages in any environment at any time to perform visual debugging when an exception occurs.
[0061] If the technical solution of generating and debugging web pages on the server side is used according to the traditional technology, it is necessary to print logs on the server side, which means that the code for printing logs needs to be invaded on the original business code, and sometimes these codes may need to be deleted, which increases the complexity. In addition, the debugging method of printing logs through code cannot accurately locate the required data every time. It may face the situation of printing out part of the data, but finding that other data is needed, resulting in having to go back to the code to continue printing other required data, that is, you can only print what data you need temporarily, and you cannot get all the data. Therefore, these methods cannot achieve "once and for all". At the same time, the object data readability of this debugging method is poor. The server-side log debugging method is to print the log information to the server terminal, and the printed data is in the form of a string. If you encounter some large objects, the printed data will be a long string, and the readability is very poor. In the above web page debugging method, the terminal sends a web page debugging request to the server through a browser, and receives a blank debugging web page and a script debugging module returned by the server. The browser on the terminal can run the script debugging module to generate a complete debugging web page. Since the debugging web page is simulated and generated by the script debugging module, when an exception occurs during the generation of the debugging web page, the monitoring file contained in the script debugging module can monitor the exception information and display it on a visual debugging web page, and the browser's built-in debugging tool can be used to accurately breakpoint debug the exception information on the visual debugging web page. This solution can perform breakpoint debugging on the browser to render the output code of the server, which means that the debugging process does not require writing any code, and all data can be obtained only through the browser's built-in console breakpoint debugging. Since the breakpoint debugging method is very simple, you only need to set a breakpoint on the corresponding code on the browser console, and the code will be executed to the breakpoint position. At this time, you can view any data before the breakpoint, and you can obtain the data of the abnormal position that the technician wants at any time. And the breakpoint reading data belongs to the function provided by the browser's built-in debugging console. The technician can use its ability to easily read various complex object data, with a good reading experience. At the same time, the conventional technical solution of generating debugging web pages by rendering on the server side generally only returns some error status codes when an exception occurs. The HTML page may display some specific error pages or a blank page. However, in this solution, when an exception occurs in the HTML page rendering, the error information will be directly output to the HTML page as a prompt, which is convenient for debuggers to read. This method greatly reduces the difficulty of debugging mobile browsers. The code that originally needed to perform the HTML page rendering process on the server side is executed on the browser, which is equivalent to debugging the code on both the browser and the server side only on the browser side, which greatly improves the debugging efficiency and reduces the debugging cost.
[0062] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0063] In one embodiment, Figure 3 As shown, a web page debugging device is provided, including: a request sending module, a file receiving module, a web page fragment generating module and an abnormality monitoring module, wherein:
[0064] The request sending module 301 is used to send a web page debugging request to the server.
[0065] The file receiving module 302 is used to receive debugging web page data and a script debugging module returned by the server according to the web page debugging request. The script debugging module includes web page data, monitoring files and web page fragment generation files.
[0066] The web page fragment generation module 303 is used to run the web page fragment generation file to obtain the variable name of the web page data; run the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate the web page fragment code corresponding to the target web page, which includes the expected target web page style, label and interaction information in the web page fragment code.
[0067] The exception monitoring module 304 is used to display corresponding exception information on the debugging web page when an exception is detected in the process of generating the web page fragment code corresponding to the target web page.
[0068] In one embodiment, the request sending module 301 is also used to obtain the debugging parameter value corresponding to the debugging mode; use the debugging parameter value as the parameter value of the link parameter included in the web page debugging request; and send the web page debugging request with the link parameter value as the debugging parameter value to the server.
[0069] In one embodiment, the request sending module 301 is also used to obtain the official debugging parameter value corresponding to the debugging mode of the official environment when the debugging environment is the official environment; obtain the encrypted string corresponding to the official debugging parameter value; use the encrypted string as the parameter value of the link parameter included in the web page debugging request; and send the web page debugging request with the link parameter value as the encrypted string to the server.
[0070] In one embodiment, the request sending module 301 is also used to obtain a file that is executed by simulating JS by converting the execution process and monitoring process of the web page fragment generated by the server itself according to the JS language characteristics.
[0071] In one embodiment, the above-mentioned abnormality monitoring module 304 is also used to locate the abnormality according to the abnormality information and determine the corresponding abnormal node; and perform visual breakpoint debugging on the abnormal node through a debugging tool.
[0072] In one embodiment, the above-mentioned exception monitoring module 304 is also used to display a success prompt message and a preview interaction button on the debugging web page when it is monitored that there is no exception in the process of generating the web page snippet code corresponding to the target web page; click the preview interaction button to jump from the debugging web page to the visual target web page.
[0073] In one embodiment, the above-mentioned exception monitoring module 304 is also used to generate corresponding success prompt information by running the monitoring file when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page; add the web page snippet code corresponding to the target web page to the debugging web page to obtain the final target web page data; parse the target web page data through the browser to generate a visual target web page, and display the success prompt information on the target web page.
[0074] In one embodiment, the web page fragment generation module 303 is further used to run a data acquisition file and call a data acquisition interface to acquire web page data of the debugging web page from the server.
[0075] The specific definition of the web page debugging device can be found in the definition of the web page debugging method above, which will not be repeated here. Each module in the above web page debugging device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0076] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a web page debugging method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0077] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0078] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: sending a web page debugging request to a server; receiving a debugging web page and a script debugging module returned by the server according to the web page debugging request, wherein the script debugging module includes web page data, a monitoring file, and a web page fragment generation file; running the web page fragment generation file to obtain a variable name of the web page data; running the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate a web page fragment code corresponding to a target web page, wherein the web page fragment code includes the expected style, label, and interactive information of the target web page; running the monitoring file, and when monitoring that an exception occurs in the process of generating the web page fragment code corresponding to the target web page, displaying corresponding exception information on the debugging web page.
[0079] In one embodiment, after displaying the corresponding exception information, the processor further implements the following steps when executing the computer program: locating the exception according to the exception information to determine the corresponding exception node; and performing visual breakpoint debugging on the exception node through a debugging tool.
[0080] In one embodiment, the script debugging module also includes a data acquisition file; when the processor executes the computer program, the following steps are also implemented: running the data acquisition file, calling the data acquisition interface to obtain the web page data of the debugging web page from the server. In one embodiment, when the processor executes the computer program, the following steps are also implemented: when monitoring that there is no abnormality in the process of generating the web page fragment code corresponding to the target web page, displaying a success prompt message and a preview interaction button on the debugging web page; clicking the preview interaction button jumps from the debugging web page to the visualized target web page.
[0081] In one embodiment, the processor also implements the following steps when executing the computer program: when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page, a corresponding success prompt message is generated by running the monitoring file; the web page snippet code corresponding to the target web page is added to the debugging web page to obtain the final target web page data; the target web page data is parsed through the browser to generate a visual target web page, and a success prompt message is displayed on the target web page.
[0082] In one embodiment, sending a web page debugging request to a server includes: obtaining a debugging parameter value corresponding to a debugging mode; using the debugging parameter value as a parameter value of a link parameter included in the web page debugging request; and sending a web page debugging request with the link parameter value as the debugging parameter value to the server.
[0083] In one embodiment, sending a web page debugging request to a server includes: when the debugging environment is a formal environment, obtaining a formal debugging parameter value corresponding to the debugging mode of the formal environment; obtaining an encrypted string corresponding to the formal debugging parameter value; using the encrypted string as a parameter value of a link parameter included in the web page debugging request; and sending the web page debugging request with the link parameter value being the encrypted string to the server.
[0084] In one embodiment, the web page fragment generation file and the monitoring file included in the script debugging module are files that are simulated and executed using JS by converting the execution process and monitoring process of the web page fragment generated by the server itself according to the JS language characteristics.
[0085] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: sending a web page debugging request to a server; receiving a debugging web page and a script debugging module returned by the server according to the web page debugging request, wherein the script debugging module includes web page data, a monitoring file, and a web page fragment generation file; running the web page fragment generation file to obtain the variable name of the web page data; running the web page fragment generation file to fill the web page data into the web page fragment code according to the variable name, and generate the web page fragment code corresponding to the target web page, wherein the web page fragment code includes the expected style, label, and interactive information of the target web page; running the monitoring file, when monitoring that the process of generating the web page fragment code corresponding to the target web page is abnormal, the corresponding abnormal information is displayed on the debugging web page. In one embodiment, the script debugging module also includes a data acquisition file; when the computer program is executed by the processor, the following steps are also implemented: running the data acquisition file, calling the data acquisition interface to obtain the web page data of the debugging web page from the server.
[0086] In one embodiment, after displaying the corresponding exception information, the computer program further implements the following steps when executed by the processor: locating the exception according to the exception information to determine the corresponding exception node; and performing visual breakpoint debugging on the exception node through a debugging tool.
[0087] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page, a success prompt message and a preview interaction button are displayed on the debugging web page; the preview interaction button is clicked to jump from the debugging web page to the visualized target web page.
[0088] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when it is monitored that there is no abnormality in the process of generating the web page snippet code corresponding to the target web page, a corresponding success prompt message is generated by running the monitoring file; the web page snippet code corresponding to the target web page is added to the debugging web page to obtain the final target web page data; the target web page data is parsed by the browser to generate a visual target web page, and a success prompt message is displayed on the target web page.
[0089] In one embodiment, sending a web page debugging request to a server includes: obtaining a debugging parameter value corresponding to a debugging mode; using the debugging parameter value as a parameter value of a link parameter included in the web page debugging request; and sending a web page debugging request with the link parameter value as the debugging parameter value to the server.
[0090] In one embodiment, sending a web page debugging request to a server includes: when the debugging environment is a formal environment, obtaining a formal debugging parameter value corresponding to the debugging mode of the formal environment; obtaining an encrypted string corresponding to the formal debugging parameter value; using the encrypted string as a parameter value of a link parameter included in the web page debugging request; and sending the web page debugging request with the link parameter value being the encrypted string to the server.
[0091] In one embodiment, the web page fragment generation file and the monitoring file included in the script debugging module are files that are simulated and executed using JS by converting the execution process and monitoring process of the web page fragment generated by the server itself according to the JS language characteristics.
[0092] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0093] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0094] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A web page debugging method, the method comprising: Send a web page debugging request to the server; Receiving a debugging webpage and a script debugging module returned by the server according to the webpage debugging request, wherein the script debugging module includes webpage data, a monitoring file, and a webpage fragment generation file; Run the webpage fragment generation file to obtain the variable name of the webpage data; Running the webpage fragment generation file to fill the webpage data into the webpage fragment code according to the variable name, generating the webpage fragment code corresponding to the target webpage, wherein the webpage fragment code includes the expected style, label and interaction information of the target webpage; Running the monitoring file, when monitoring that an abnormality occurs in the process of generating the webpage snippet code corresponding to the target webpage, displaying corresponding abnormal information on the debugging webpage; The step of sending a web page debugging request to a server includes: When the debugging environment is the formal environment, obtain the formal debugging parameter value corresponding to the debugging mode of the formal environment; Obtaining the encrypted string corresponding to the formal debugging parameter value; Using the encrypted string as the parameter value of the link parameter included in the web page debugging request; The web page debugging request with the link parameter value being the encrypted string is sent to the server.
2. The method according to claim 1, characterized in that After the corresponding abnormal information is displayed on the debugging webpage, the method further includes: Locate the abnormality according to the abnormal information and determine the corresponding abnormal node; Visual breakpoint debugging is performed on the abnormal node through a debugging tool.
3. The method according to claim 1, characterized in that The method further comprises: When it is monitored that there is no abnormality in the process of generating the webpage snippet code corresponding to the target webpage, a success prompt message and a preview interaction button are displayed on the debugging webpage; Click the preview interaction button to jump from the debugging web page to the visualized target web page.
4. The method according to claim 1, characterized in that: The method further comprises: When it is monitored that there is no abnormality in the process of generating the webpage snippet code corresponding to the target webpage, a corresponding success prompt message is generated by running the monitoring file; Adding the webpage snippet code corresponding to the target webpage to the debugging webpage to obtain the final target webpage data; The target web page data is parsed by a browser to generate a visual target web page, and the success prompt information is displayed on the target web page.
5. The method according to claim 1, characterized in that The sending of the web page debugging request to the server includes: Get the debugging parameter value corresponding to the debugging mode; Using the debugging parameter value as the parameter value of the link parameter included in the webpage debugging request; The webpage debugging request with the link parameter value being the debugging parameter value is sent to the server.
6. The method according to claim 1, characterized in that The webpage fragment generation file and the monitoring file contained in the script debugging module are files that are simulated and executed by using JS by converting the execution process and monitoring process of the webpage fragment generated by the server itself according to the JS language characteristics.
7. A web page debugging device, characterized in that: The device comprises: A request sending module is used to send a web page debugging request to the server; A file receiving module, used to receive debugging web page data and a script debugging module returned by the server according to the web page debugging request, wherein the script debugging module includes web page data, monitoring files and web page fragment generation files; A webpage fragment generation module is used to execute the webpage fragment generation file to obtain the variable name of the webpage data; execute the webpage fragment generation file to fill the webpage data into the webpage fragment code according to the variable name, and generate the webpage fragment code corresponding to the target webpage, wherein the webpage fragment code includes the expected style, label and interaction information of the target webpage; An exception monitoring module is used to display corresponding exception information on the debugging web page when an exception is detected in the process of generating the web page fragment code corresponding to the target web page; Wherein, in the aspect of sending the webpage debugging request to the server, the request sending module is specifically used for: When the debugging environment is the formal environment, obtain the formal debugging parameter value corresponding to the debugging mode of the formal environment; Obtaining the encrypted string corresponding to the formal debugging parameter value; Using the encrypted string as the parameter value of the link parameter included in the web page debugging request; The web page debugging request with the link parameter value being the encrypted string is sent to the server.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
