CN110287056B - Webpage error information acquisition method and device - Google Patents

Webpage error information acquisition method and device Download PDF

Info

Publication number
CN110287056B
CN110287056B CN201910599613.4A CN201910599613A CN110287056B CN 110287056 B CN110287056 B CN 110287056B CN 201910599613 A CN201910599613 A CN 201910599613A CN 110287056 B CN110287056 B CN 110287056B
Authority
CN
China
Prior art keywords
error
webpage
web page
code
interaction data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910599613.4A
Other languages
Chinese (zh)
Other versions
CN110287056A (en
Inventor
安亚楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Xizhi Information Technology Co ltd
Original Assignee
Zhengzhou Xizhi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Xizhi Information Technology Co ltd filed Critical Zhengzhou Xizhi Information Technology Co ltd
Priority to CN201910599613.4A priority Critical patent/CN110287056B/en
Publication of CN110287056A publication Critical patent/CN110287056A/en
Application granted granted Critical
Publication of CN110287056B publication Critical patent/CN110287056B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a method and a device for acquiring webpage error information, wherein the method is applied to a browser and comprises the following steps: acquiring webpage interaction data between a browser and a server, wherein the webpage interaction data comprises: the server feeds back the webpage data to the browser and the user operation data of the user on the webpage displayed by the browser; performing error detection on the webpage interaction data according to an error capturing rule corresponding to a preset error type; if the webpage error is detected based on the webpage interaction data, acquiring error source information causing the webpage error according to an error positioning rule corresponding to an error type to which the webpage error belongs; and reporting the error type of the webpage error and the error source information to back-end equipment. According to the scheme, the webpage error information existing in the webpage access process of the user can be found in time.

Description

Webpage error information acquisition method and device
Technical Field
The present disclosure relates to the field of web applications, and in particular, to a method and an apparatus for obtaining web error information.
Background
After the web page is developed, a tester tests the web page to detect possible errors in the running process of the web page script, so as to reduce the web page errors.
However, after the web page of the website is put into use, errors which cannot be found in the test process often occur in the process of the user accessing the web page of the website. However, how to timely find out the error information existing in the process of accessing the web page is a technical problem that needs to be solved by those skilled in the art.
Disclosure of Invention
In view of this, the present application provides a method and apparatus for obtaining error information of a web page, so as to discover and solve the situation of causing the error of the web page in time.
In order to achieve the above objective, in one aspect, the present application provides a method for obtaining web page fault information, which is applied to a browser, and includes:
acquiring webpage interaction data between a browser and a server, wherein the webpage interaction data comprises: the server feeds back the webpage data of the browser and the user operation data of the user on the webpage displayed by the browser;
performing error detection on the webpage interaction data according to an error capturing rule corresponding to a preset error type;
if the webpage errors are detected based on the webpage interaction data, acquiring error source information causing the webpage errors according to error positioning rules corresponding to error types to which the webpage errors belong;
and reporting the error type of the webpage error and the error source information to back-end equipment.
Preferably, the performing error detection on the web page interaction data according to an error capturing rule corresponding to a preset error type includes:
detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to a preset error label of the resource loading error, wherein the error label is used for representing that the resource loading error exists;
if a web page error is detected based on the web page interaction data, obtaining error source information causing the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, including:
if the error label of the resource loading error is detected in the webpage interaction data, acquiring a page link with the resource loading error by running a page link capturing function, and acquiring link information of the resource with the resource loading error by running the resource link capturing function.
Preferably, the performing error detection on the web page interaction data according to an error capturing rule corresponding to a preset error type includes:
detecting whether a state code belonging to network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to a preset network request abnormality;
if a web page error is detected based on the web page interaction data, obtaining error source information causing the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, including:
under the condition that the request exception capturing function detects a status code representing network request exception, acquiring a first error code position through the request exception capturing function, wherein the first error code position is the position of a code causing the network request exception;
and intercepting the state code of the network request exception and the first error code position, which are obtained by the request exception capturing function, through a callback function.
Preferably, if a web page error is detected based on the web page interaction data, obtaining error source information that causes the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, and further including:
and detecting a state code representing network request abnormality at the request abnormality capturing function, and intercepting the state code of the network request abnormality obtained by the abnormality capturing function through a callback function corresponding to the request abnormality capturing function if the first error code position is not obtained by the request abnormality capturing function.
Preferably, the error detection is performed on the web page interaction data according to an error capturing rule corresponding to a preset error type, and the method further includes:
performing webpage code operation error detection on the webpage interaction data through a preset operation error capturing function;
if the web page error is detected based on the web page interaction data, obtaining error source information causing the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, and further comprising:
and if the running error capturing function detects the running error of the webpage code, acquiring the running error of the webpage code captured by the running error capturing function and a second error code position by a callback function corresponding to the running error capturing function, wherein the second error code position is the code position with the running error of the webpage code.
In still another aspect, the present application further provides a device for obtaining web page fault information, which is applied to a browser, and includes:
the data acquisition unit is used for acquiring webpage interaction data between the browser and the server, wherein the webpage interaction data comprise: the server feeds back the webpage data of the browser and the user operation data of the user on the webpage displayed by the browser;
the error detection unit is used for carrying out error detection on the webpage interaction data according to an error capturing rule corresponding to a preset error type;
an error source obtaining unit, configured to obtain error source information that causes the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs if the web page error is detected based on the web page interaction data;
and the error reporting unit is used for reporting the error type of the webpage error and the error source information to the back-end equipment.
Preferably, the error detection unit includes:
the first error detection unit is used for detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to a preset error label of the resource loading error, and the error label is used for representing that the resource loading error exists;
the error source acquisition unit includes:
the first error source acquisition unit is used for acquiring page links with the resource loading errors by running a page link acquisition function and acquiring link information of the resource with the resource loading errors by running the resource link acquisition function if error labels with the resource loading errors are detected in the webpage interaction data.
Preferably, the error detection unit includes:
the second error detection unit is used for detecting whether a state code belonging to network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to a preset network request abnormality;
the error source acquisition unit includes:
a second error source acquisition unit, configured to acquire, by the request exception capture function, a first error code position, where the first error code position is a position of a code that causes the network request exception, when the request exception capture function detects a status code that characterizes the network request exception;
and the first error source interception unit is used for intercepting the state code of the network request exception and the first error code position, which are obtained by the request exception capturing function, through a callback function.
Preferably, the error source acquisition unit further includes:
and the second error source interception unit is used for detecting a state code representing network request abnormality at the request abnormality capture function, intercepting the state code of the network request abnormality obtained by the abnormality capture function through a callback function corresponding to the request abnormality capture function if the first error code position is not obtained by the request abnormality capture function.
Preferably, the error detection unit further includes:
the third error detection unit is used for detecting webpage code operation errors of the webpage interaction data through a preset operation error capture function;
the error source acquisition unit further includes:
a third error source interception unit for, if the running error capturing function detects web page code
The running error is acquired through a callback function corresponding to the running error capturing function
A second error code position and a running error of the web page code captured by the error capturing function, wherein the second error code position is that
The two error code positions are code positions with running errors of the webpage code.
According to the technical scheme, the browser can acquire the webpage interaction data between the browser and the server, the webpage errors in the webpage access process of the user can be found in time through error detection of the webpage interaction data, and after the webpage errors are detected, error source information causing the webpage errors can be acquired according to error positioning rules matched with the error types of the webpage errors, so that the browser can report the webpage errors and the error source information existing in the webpage access process to the back-end equipment in time, and a developer can find various errors and error source information existing in the webpage access process of the user in time through the back-end equipment, so that the webpage errors can be found and solved in time.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for acquiring page fault information according to the present application;
FIG. 2 is a schematic flow chart of a page fault information obtaining method according to the present application;
FIG. 3 is a schematic flow chart of a method for obtaining web page fault information according to the present application;
fig. 4 is a schematic diagram showing a constitution of a web page fault information acquiring apparatus of the present application.
Detailed Description
The scheme of the embodiment of the application is suitable for acquiring the webpage error information generated in the webpage access process, so that the webpage error can be found and solved in time.
The following describes the aspects of the present application with reference to the accompanying drawings.
Referring to fig. 1, which shows a flow chart of a web page error information obtaining method in the present application, the solution of the present application is applied to a browser, and the embodiment may include:
s101, acquiring webpage interaction data between a browser and a server.
The webpage interaction data comprises: and the server feeds back the webpage data to the browser, user operation data of a user on a webpage displayed by the browser and the like.
The webpage data fed back to the browser by the server comprise webpage source codes, some popup data in the webpage display process and other webpage-related data.
The user operation data may include: specific operations performed by the user and objects corresponding to the operations, such as operations of refreshing a page, clicking a button or sliding a finger, and the like. User information of the input operation, such as a user name, user authority, and login time of the user, etc., may also be included.
Optionally, the user operation data may further include an operation screenshot of a detected user operation on a web page displayed on the browser, such as a click, a touch swipe, or the like on the web page.
It can be understood that the webpage errors occurring in the process that the user accesses the webpage of the server through the browser can be reflected through the interactive data between the server and the browser, so that the webpage errors in the webpage access process can be comprehensively found by acquiring the webpage interactive data.
The manner of acquiring the web page interaction data between the browser and the server may be various, for example, in an alternative implementation manner, a JS (JavaScript) script file is preset in the browser, and the web page interaction data may be acquired through the JS script file.
S102, performing error detection on the webpage interaction data according to an error capturing rule corresponding to the preset error type.
For example, in the case where the browser is preset with a JS script file, an error capturing rule corresponding to the error type may be preset in the JS script file.
It will be appreciated that, considering that there may be multiple possible types of web page errors occurring during the process of accessing the web page of the server, in order to more fully capture different types of web page errors, error capturing rules corresponding to each of the multiple different error types may be preset in step S102.
For example, in one possible case, considering that in the web page access process, a more common error type is that a resource loading error occurs in a web page, for example, a loading error of a resource such as a picture, a video, a document, etc. occurs in the web page, so an error capturing rule corresponding to the resource loading error may be preset. If the error label belonging to the resource loading error exists, the detection of the resource loading error is confirmed.
In yet another possible scenario, the error type of the web page error may be a web request exception. The network request exception is an interface request error when requesting a page from a server, commonly known as an interface request error when operating a page. For example, a network request exception may include: representing that the network request of the webpage corresponding to the link does not exist is abnormal, namely, commonly called 404 error; and characterizing network access anomalies due to server errors, namely commonly known as 500 errors, and network request anomalies such as 400 errors. In this case, a status code corresponding to the network request abnormality may be preset, and whether the status code of the network request abnormality exists in the network interaction data may be detected. For example, the status code may be 404 (or 404 error), 500 (or 500 error), etc.
Optionally, a request exception capturing function for capturing network request exceptions may detect whether a status code representing the network request exceptions exists in the web page interaction data, and if the status code exists, the network request exceptions represented by the status code are represented.
In yet another possible scenario, the error types of web page errors may include: the running errors of the webpage codes can specifically comprise code grammar errors, code logic errors and the like, and the errors can be found in the webpage test process, but in order to avoid that the corresponding errors are not detected in the test, error detection rules of the errors can be preset.
Optionally, on the basis of presetting error detection rules corresponding to other at least one webpage error, presetting error detection rules corresponding to the running errors of the webpage codes. For example, a running error trapping function may be preset, which may be a global error trapping function in the JS file. Correspondingly, the webpage code operation error detection is carried out on the webpage interaction data through the operation error capturing function, so that the webpage code operation error is determined based on the webpage interaction data.
Of course, in practical application, the web page errors may have other error types, which is not limited in this application.
And S103, if the webpage error is detected based on the webpage interaction data, acquiring error source information causing the webpage error according to an error positioning rule corresponding to the error type to which the webpage error belongs.
Wherein the error localization rule is used to determine source information that causes the web page error, such as a resource link, a web page link, or a code location that causes the web page error, and the like.
It will be appreciated that the error localization rules may be different for different types of web page errors, and that several possible cases of obtaining error source information will be described below by taking the foregoing cases of web page errors as examples.
For example, in a possible case that the error type of the web page error is a resource loading error, if an error tag of the resource loading error is detected in the web page interaction data, a page link where the resource loading error occurs is obtained by running a page link capturing function, and link information of a resource where the resource loading error occurs is obtained by running the resource link capturing function.
The page link capturing function is used for positioning page links of pages corresponding to resource loading errors. The resource link capturing function is used for positioning link information corresponding to resources with wrong resource loading, and if the picture loading is wrong, the link of the picture is obtained.
In yet another possible scenario, in the event that the error type of the web page error is a network request exception, in the event that a status code characterizing the network request exception is detected by a request exception capture function, a first error code location is obtained by the request exception capture function. Wherein the first error code location is a location of a code that caused the network request exception; then, the callback function intercepts the state code of the network request exception and the first error code position, which are obtained by the request exception capture function.
For another example, for a running error of the web page code, if the running error capturing function detects the running error of the web page code through a callback function set in the error capturing function, the running error of the web page code captured by the running error capturing function and a second error code position can be captured by the callback function, wherein the second error code position is a code position where the running error of the web page code exists, such as information of a code row or a code column where the running error occurs.
S104, reporting the error type of the webpage error and the error source information to the back-end equipment.
As can be seen from the description of the foregoing cases, when the types of the web page errors are different, the content included in the error source information will also be different, and in practical application, the browser may detect one web page error at the same time, or may detect multiple web page errors at the same time, but for each detected web page error, the browser will report the corresponding error source information to the back-end device.
The backend device may be a server, or may be a data storage device of a background, which is not limited in this application.
It can be understood that, in order to enable users such as webpage maintainers to quickly solve the specific problem of causing webpage errors through error types and error source information acquired by the back-end equipment, the application can also report the moment of detecting the webpage errors and the operation screenshot of the user intercepted at the moment to the back-end equipment together.
Therefore, the browser can acquire the webpage interaction data between the browser and the server, the webpage errors in the webpage accessed by the user can be found in time through error detection of the webpage interaction data, and after the webpage errors are detected, error source information causing the webpage errors can be acquired according to error positioning rules matched with the error types of the webpage errors, so that the browser can report the webpage errors and the error source information existing in the webpage access process to the back-end equipment in time, and a developer can timely find out various errors and error source information existing in the webpage access process through the back-end equipment, thereby being beneficial to timely finding and solving the webpage errors.
For ease of understanding, the present application will be described with reference to a web page fault acquisition process, and the following description will describe a process for acquiring resource loading faults and related fault source information.
As shown in fig. 2, which is a schematic flow chart of a web page fault information obtaining method of the present application, the method of the present embodiment is illustrated by taking a case of obtaining a resource loading fault as an example, and the method of the present embodiment may include:
s201, acquiring webpage interaction data between a browser and a server.
The webpage interaction data comprises: and the server feeds back the webpage data to the browser and the user operation data of the user on the webpage displayed by the browser.
Of course, the web page interaction data may also include user action shots. Or, although the webpage interaction data does not contain the operation screenshot of the user, the operation screenshot of the user is obtained while the webpage interaction data is obtained.
S202, detecting whether error labels belonging to resource loading errors exist in the webpage interaction data according to preset error labels of the resource loading errors.
Wherein the error tag is used to characterize that there is a resource loading error. For example, error tags for resource loading errors may include error tags that characterize picture loading errors, error tags that characterize video loading errors, and so forth.
For example, a resource loading error capturing function for capturing a resource loading error is preset in the JS file, and the resource loading error capturing function can detect whether a corresponding error tag exists. For example, one resource loading error capture function may be "window. AddEventListerner ('error').
S203, if the error label of the resource loading error is detected in the webpage interaction data, acquiring the page link of the resource loading error by running a page link capturing function, and acquiring the link information of the resource loading error by running the resource link capturing function.
Optionally, after detecting the error tag in the web page interaction data, an element with a resource loading error, for example, a specific element with a resource loading error, for example, an element with a picture loading error, may be obtained. For example, for a picture loading error, an element of the picture in which the error occurs may be acquired through "event. Path".
The specific form of the page link capturing function may also be various, for example, may be "event. Accordingly, there are also many possibilities for the resource link capture function, for example, the resource link capture function may be: "event.
S204, page links corresponding to the resource loading errors and link information of the resources are sent to the back-end equipment.
In this embodiment, the error source information may include a page link of a resource loading error and link information of the resource; of course, it may also include: user operation screen shots, etc.
Fig. 2 illustrates error detection rules and error capturing rules corresponding to preset resource loading errors, and error information related to the resource loading errors is obtained, but for the other errors, the sequence of the detection process may be referred to except for the difference between the detection rules and the capturing rules.
It can be understood that, considering that various error detection rules and error capturing rules of web page errors can be preset in the present application, and meanwhile, in order to facilitate understanding of the error information acquisition method of web page errors of different types in the present application, the scheme of the present application is described below by taking the acquisition of error information of various types of network errors at the same time as an example.
Referring to fig. 3, a flowchart illustrating a method for obtaining web page fault information according to another embodiment of the present application is shown, where the method of the present embodiment may include:
s301, acquiring webpage interaction data between the browser and the server by running a JS file preset in the browser, and intercepting an operation screenshot of user operation on the browser side.
In this embodiment, the web page interaction data is obtained through the JS file running in the browser, but other modes are also applicable to this embodiment.
S302, detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to the error label of the resource loading error preset in the JS file.
S303, if an error label of the resource loading error is detected in the webpage interaction data, acquiring a page link of the resource loading error by running a page link capturing function in the JS file, and acquiring link information of the resource loading error by running the resource link capturing function in the JS file.
The steps S302 and S303 may be referred to the related description of the previous embodiments, and will not be described herein.
S304, detecting whether a state code belonging to the network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to the preset network request abnormality in the JS file.
For example, the status code may be 404, 500, etc. that characterizes the network request exception. If the state code in the captured web page interaction data is captured by the anomaly capture function, then the network request is considered to be anomalous.
S305, in the case that the request exception capturing function detects a status code representing network request exception, acquiring a first error code position through the request exception capturing function.
Wherein the first error code location is the location of the code that caused the network request exception.
For example, the request exception capture function may be an encapsulated ajax request by which exceptions may be thrown when a network request exception is detected. Meanwhile, for some network anomalies, such as 404 errors, the ajax request can find the place where the error occurs on the page according to the interface name where the error occurs. Of course, the request exception capture function may also include an error code capture function by which the location of the code where the error occurred is obtained, e.g., after the network request exception is detected by the ajax request, the number of ranks of the code where the error occurred may be obtained in combination with the function "window.
Of course, the request exception obtaining function may also be window.addEventListener ('error', (msg, url, row, col, error), but this method cannot determine the exception type of the network request exception, such as 404 or 500, and the server log needs to be obtained for investigation and analysis.
S306, if the first error code position is obtained through the request exception capture function, the callback function corresponding to the request exception capture function intercepts the network request exception status code and the first error code position obtained through the request exception capture function.
The callback function can intercept the state code of the network exception error captured by the exception capturing function and related information.
For example, in the case that the request exception capturing function is addEventListener, in order to solve the problem of cross-domain hijacking, the addEventListener code which is native in the JS file can be hijacked, and a layer of try () { } is added to the callback function in the addEventListener code, so that errors thrown in the callback function can be hijacked, and a browser cannot intercept the hijacked exception in a cross-domain manner, so that detailed error information can be obtained.
S307, under the condition that the request exception capturing function detects the state code representing the network request exception and the first error code position is not acquired by the request exception capturing function, the callback function corresponding to the request exception capturing function captures the state code of the network request exception acquired by the request exception capturing function.
It can be understood that if the request exception acquisition function is window, addEventListener ('error', (msg, url, row, col, error), or the network request exception is 500, etc., the error code location cannot be directly acquired through the ajax request and other functions, the callback function may directly acquire the status code acquired by the request exception acquisition function, and then the server acquires the server log at the corresponding moment according to the moment when the status code is acquired for further analysis.
Of course, the exception acquisition function may also be a method of a coherent, in which case the coherent may be hijacked to capture the error of the thrown network request exception.
The sequence of steps S304-S306 and steps S302-S303 is not limited to that shown in fig. 3, and in practical applications, steps S304-S306 may be executed simultaneously with steps S302-S303.
S308, performing webpage code operation error detection on the webpage interaction data through an operation error capturing function preset in the JS file.
For example, in one possible scenario, the error trapping function may be a global error trapping function preset in the JS file, for example, the error trapping function may include: "indow.addeventlistener (' error ')" and "window.addeventlistener (' unhandledrejection". If compatibility is considered, the error capture function may also contain window.onerror.
S309, if the running error capturing function detects the running error of the webpage code, acquiring the running error of the webpage code captured by the running error capturing function and the second error code position through a callback function corresponding to the running error capturing function.
The second error code position is a code position with a running error of the webpage code.
The callback function is used for hijacking the webpage code operation errors captured by the operation error capturing function and finally locating the second error code positions.
Of course, the running error capturing function throws out the running error of the web code by adopting the method of the error, in which case the error can be hijacked to capture the thrown out running error of the web code and the second error code position.
It will be appreciated that steps S308 and S309 may also be performed concurrently with any of the preceding steps S304-S306 and steps S302-S303, as this application is not limited in this respect.
It will be appreciated that in the event of network request anomalies and web page code running errors, it is desirable to locate the code location where the error occurred, e.g., the information of the row and/or column of the code where the error occurred. In the case that the web page code is a compressed JS file, in order to obtain the code position where the error occurs, a source mapping source-map function may be called in combination with the request exception capture function and the operation error capture function, so as to finally determine the actual code position. For example, the request exception capturing function captures a first compressed code position in the compressed JS file, where the first compressed code position causes an exception in the network request, and may call the source-map function to convert the first actual error code position to obtain a code row or column where an error exists actually. The same is true for the run error trapping function.
And S310, under the condition that the webpage errors are detected, transmitting the acquired error types, error source information and operation screenshots of the users of the webpage errors to the back-end equipment.
The content of the error source information may also be different according to the difference between the error information captured in the previous steps S302-309, for example, the page link with the resource loading error and the link information of the resource are obtained in the above step 303, the status code of the network request exception and the first error code location are obtained in step S307, and the running error of the web page code and the second error code location are obtained in step S309, and the error source information may include: the resource loads wrong page links and link information of the resource, the network requests abnormal status codes and the first error code position, and the webpage code running errors and the second error code position. Of course, in practical applications, the error source information obtained each time may be only one of several error information.
Corresponding to the webpage error information acquisition method, the webpage error information acquisition device is further provided. Referring to fig. 4, a flowchart of an embodiment of a web page fault information obtaining apparatus according to the present application is shown, where the method of the present embodiment may be applied to a browser, and the apparatus may include:
the data obtaining unit 401 is configured to obtain web page interaction data between the browser and the server, where the web page interaction data includes: the server feeds back the webpage data of the browser and the user operation data of the user on the webpage displayed by the browser;
an error detection unit 402, configured to perform error detection on the web page interaction data according to an error capturing rule corresponding to a preset error type;
an error source obtaining unit 403, configured to obtain error source information that causes the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs if the web page error is detected based on the web page interaction data;
and the error reporting unit 404 is configured to report the error type of the web page error and the error source information to a back-end device.
In one possible case, the error detection unit includes:
the first error detection unit is used for detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to a preset error label of the resource loading error, and the error label is used for representing that the resource loading error exists;
the error source acquisition unit includes:
the first error source acquisition unit is used for acquiring page links with the resource loading errors by running a page link acquisition function and acquiring link information of the resource with the resource loading errors by running the resource link acquisition function if error labels with the resource loading errors are detected in the webpage interaction data.
In yet another possible case, the error detection unit includes:
the second error detection unit is used for detecting whether a state code belonging to network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to a preset network request abnormality;
the error source acquisition unit includes:
a second error source acquisition unit, configured to acquire, by the request exception capture function, a first error code position, where the first error code position is a position of a code that causes the network request exception, when the request exception capture function detects a status code that characterizes the network request exception;
the first error source interception unit is used for intercepting the network request abnormal state code and the first error code position obtained by the request abnormal capturing function through a callback function corresponding to the request abnormal capturing function.
Optionally, the error source obtaining unit further includes:
and the second error source interception unit is used for detecting a state code representing network request abnormality at the request abnormality capture function, intercepting the state code of the network request abnormality obtained by the abnormality capture function through a callback function corresponding to the request abnormality capture function if the first error code position is not obtained by the request abnormality capture function.
In an embodiment of the above apparatus, the error detection unit may further include:
the third error detection unit is used for detecting webpage code operation errors of the webpage interaction data through a preset operation error capture function;
the error source acquisition unit further includes:
and the third error source interception unit is used for acquiring the webpage code running error captured by the running error capturing function and a second error code position through a callback function corresponding to the running error capturing function if the running error capturing function detects the webpage code running error, wherein the second error code position is a code position with the webpage code running error.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the apparatus class embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference is made to the description of the method embodiments for relevant points.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. The web page error information acquisition method is characterized by being applied to a browser and comprising the following steps of:
acquiring webpage interaction data between a browser and a server, wherein the webpage interaction data comprises: the server feeds back the webpage data of the browser and the user operation data of the user on the webpage displayed by the browser;
performing error detection on the webpage interaction data according to an error capturing rule corresponding to a preset error type;
if the webpage errors are detected based on the webpage interaction data, acquiring error source information causing the webpage errors according to error positioning rules corresponding to error types to which the webpage errors belong; the error source information comprises resource links, web links or code positions which cause web errors;
reporting the error type of the webpage error and the error source information to back-end equipment;
and reporting the moment when the webpage error is detected and the operation screenshot of the user intercepted at the moment to the back-end equipment.
2. The method for obtaining web page fault information according to claim 1, wherein the performing fault detection on the web page interaction data according to the fault capturing rule corresponding to the preset fault type includes:
detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to a preset error label of the resource loading error, wherein the error label is used for representing that the resource loading error exists;
if a web page error is detected based on the web page interaction data, obtaining error source information causing the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, including:
if the error label of the resource loading error is detected in the webpage interaction data, acquiring a page link with the resource loading error by running a page link capturing function, and acquiring link information of the resource with the resource loading error by running the resource link capturing function.
3. The method for obtaining web page fault information according to claim 1, wherein the performing fault detection on the web page interaction data according to the fault capturing rule corresponding to the preset fault type includes:
detecting whether a state code belonging to network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to a preset network request abnormality;
under the condition that the request exception capturing function detects a status code representing network request exception, acquiring a first error code position through the request exception capturing function, wherein the first error code position is the position of a code causing the network request exception;
and intercepting the state code of the network request exception and the first error code position, which are obtained by the request exception capturing function, through a callback function.
4. The web page fault information acquisition method as claimed in claim 3, wherein if a web page fault is detected based on the web page interaction data, acquiring the fault source information that causes the web page fault according to a fault location rule corresponding to a fault type to which the web page fault belongs, further comprising:
and detecting a state code representing network request abnormality at the request abnormality capturing function, and intercepting the state code of the network request abnormality obtained by the abnormality capturing function through a callback function corresponding to the request abnormality capturing function if the first error code position is not obtained by the request abnormality capturing function.
5. The method for obtaining web page fault information according to claim 2 or 3, wherein the performing fault detection on the web page interaction data according to the fault capturing rule corresponding to the preset fault type further comprises:
performing webpage code operation error detection on the webpage interaction data through a preset operation error capturing function;
if the web page error is detected based on the web page interaction data, obtaining error source information causing the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs, and further comprising:
and if the running error capturing function detects the running error of the webpage code, acquiring the running error of the webpage code captured by the running error capturing function and a second error code position by a callback function corresponding to the running error capturing function, wherein the second error code position is the code position with the running error of the webpage code.
6. A web page fault information acquisition device, applied to a browser, comprising:
the data acquisition unit is used for acquiring webpage interaction data between the browser and the server, wherein the webpage interaction data comprise: the server feeds back the webpage data of the browser and the user operation data of the user on the webpage displayed by the browser;
the error detection unit is used for carrying out error detection on the webpage interaction data according to an error capturing rule corresponding to a preset error type;
an error source obtaining unit, configured to obtain error source information that causes the web page error according to an error positioning rule corresponding to an error type to which the web page error belongs if the web page error is detected based on the web page interaction data; the error source information comprises resource links, web links or code positions which cause web errors;
and the error reporting unit is used for reporting the error type of the webpage error and the error source information to the back-end equipment, and reporting the moment when the webpage error is detected and the operation screenshot of the user intercepted at the moment to the back-end equipment.
7. The web page fault information acquisition device as claimed in claim 6, wherein the fault detection unit includes:
the first error detection unit is used for detecting whether an error label belonging to the resource loading error exists in the webpage interaction data according to a preset error label of the resource loading error, and the error label is used for representing that the resource loading error exists;
the error source acquisition unit includes:
the first error source acquisition unit is used for acquiring page links with the resource loading errors by running a page link acquisition function and acquiring link information of the resource with the resource loading errors by running the resource link acquisition function if error labels with the resource loading errors are detected in the webpage interaction data.
8. The web page fault information acquisition device as claimed in claim 6, wherein the fault detection unit includes:
the second error detection unit is used for detecting whether a state code belonging to network request abnormality exists in the webpage interaction data according to a request abnormality capturing function corresponding to a preset network request abnormality;
a second error source acquisition unit, configured to acquire, by the request exception capture function, a first error code position, where the first error code position is a position of a code that causes the network request exception, when the request exception capture function detects a status code that characterizes the network request exception;
and the first error source interception unit is used for intercepting the state code of the network request exception and the first error code position, which are obtained by the request exception capturing function, through a callback function.
9. The web page fault information acquisition device of claim 8, wherein the fault source acquisition unit further comprises:
and the second error source interception unit is used for detecting a state code representing network request abnormality at the request abnormality capture function, intercepting the state code of the network request abnormality obtained by the abnormality capture function through a callback function corresponding to the request abnormality capture function if the first error code position is not obtained by the request abnormality capture function.
10. The web page fault information acquisition device according to claim 7 or 8, wherein the fault detection unit further comprises:
the third error detection unit is used for detecting webpage code operation errors of the webpage interaction data through a preset operation error capture function;
the error source acquisition unit further includes:
and the third error source interception unit is used for acquiring the webpage code running error captured by the running error capturing function and a second error code position through a callback function corresponding to the running error capturing function if the running error capturing function detects the webpage code running error, wherein the second error code position is a code position with the webpage code running error.
CN201910599613.4A 2019-07-04 2019-07-04 Webpage error information acquisition method and device Active CN110287056B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910599613.4A CN110287056B (en) 2019-07-04 2019-07-04 Webpage error information acquisition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910599613.4A CN110287056B (en) 2019-07-04 2019-07-04 Webpage error information acquisition method and device

Publications (2)

Publication Number Publication Date
CN110287056A CN110287056A (en) 2019-09-27
CN110287056B true CN110287056B (en) 2023-04-28

Family

ID=68021890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910599613.4A Active CN110287056B (en) 2019-07-04 2019-07-04 Webpage error information acquisition method and device

Country Status (1)

Country Link
CN (1) CN110287056B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026637B (en) * 2019-10-22 2022-11-11 苏宁云计算有限公司 Method and device for positioning problem code
CN111666204A (en) * 2020-04-17 2020-09-15 北京新意互动数字技术有限公司 Method and equipment for constructing webpage incompatible code knowledge base
CN111782464B (en) * 2020-06-22 2024-04-26 北京异乡旅行网络科技有限公司 Webpage dynamic anomaly monitoring method and system
CN112527643A (en) * 2020-12-11 2021-03-19 杭州安恒信息技术股份有限公司 Front-end error detection method and device, electronic equipment and readable storage medium
CN112671615B (en) * 2020-12-29 2023-07-07 中国平安财产保险股份有限公司 Method, system and storage medium for collecting front-end user operation behavior data
CN113553272A (en) * 2021-09-18 2021-10-26 深圳市信润富联数字科技有限公司 Interface abnormity monitoring method, device, medium and computer program product

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468511A (en) * 2014-09-05 2016-04-06 阿里巴巴集团控股有限公司 Web page script error positioning method and apparatus

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7739551B2 (en) * 2007-06-20 2010-06-15 Microsoft Corporation Web page error reporting
CN102739663A (en) * 2012-06-18 2012-10-17 奇智软件(北京)有限公司 Detection method and scanning engine of web pages
CN105468587B (en) * 2014-05-30 2019-10-22 北京奇虎测腾科技有限公司 A kind of webpage method for monitoring abnormality and device
CN105354126B (en) * 2015-10-13 2018-07-27 金蝶软件(中国)有限公司 Monitor method and apparatus abnormal in page script file
CN108959296A (en) * 2017-05-19 2018-12-07 北京搜狗科技发展有限公司 The treating method and apparatus of web page access mistake
CN109144755A (en) * 2017-06-19 2019-01-04 阿里巴巴集团控股有限公司 Webpage fault handling method and equipment
CN109885478A (en) * 2018-12-30 2019-06-14 贝壳技术有限公司 A kind of localization method and system of error code

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468511A (en) * 2014-09-05 2016-04-06 阿里巴巴集团控股有限公司 Web page script error positioning method and apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘群 ; 马丽艳 ; 郭子平 ; .Web应用程序截获数据库错误信息的方法.河北大学学报(自然科学版).2006,(第06期),全文. *

Also Published As

Publication number Publication date
CN110287056A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
CN110287056B (en) Webpage error information acquisition method and device
CN108595329B (en) Application testing method and device and computer storage medium
Erfani Joorabchi et al. Works for me! characterizing non-reproducible bug reports
US9465725B2 (en) Software defect reporting
US8504991B2 (en) Cross-browser testing of a web application
US8533532B2 (en) System identifying and inferring web session events
CN107025174B (en) Method, device and readable storage medium for user interface anomaly test of equipment
US9239878B2 (en) Interactivity analyses of web resources based on reload events
US7962547B2 (en) Method for server-side logging of client browser state through markup language
CN102932197B (en) Testing method and system
US9213625B1 (en) Method and apparatus for performing automated user-interface layout testing
CN103699480A (en) WEB dynamic security flaw detection method based on JAVA
US10491629B2 (en) Detecting sensitive data sent from client device to third-party
US20140129620A1 (en) Indicating coverage of web application testing
US10437717B2 (en) Defect reporting in application testing
CN113259152B (en) Network diagnosis method, network diagnosis device, electronic equipment and storage medium
CN104301175A (en) WEB service system simulation monitoring method based on browser
CN108595343A (en) The test method and device of application program
US11281521B1 (en) Methods, systems and computer readable media for troubleshooting test environments using automated analysis of log file data
Choudhary et al. A cross-browser web application testing tool
US11169910B2 (en) Probabilistic software testing via dynamic graphs
CN112100035A (en) Page abnormity detection method, system and related device
CN103198062A (en) Method for monitoring page dead link and JS error
CN113986603B (en) Method and device for determining page loading abnormity reason and storage medium
US8739130B2 (en) Quality assurance testing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant