CN110287056A - Webpage error message acquisition methods and device - Google Patents
Webpage error message acquisition methods and device Download PDFInfo
- Publication number
- CN110287056A CN110287056A CN201910599613.4A CN201910599613A CN110287056A CN 110287056 A CN110287056 A CN 110287056A CN 201910599613 A CN201910599613 A CN 201910599613A CN 110287056 A CN110287056 A CN 110287056A
- Authority
- CN
- China
- Prior art keywords
- error
- webpage
- mistake
- function
- code
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error 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/0751—Error or fault detection not based on redundancy
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error 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/0766—Error or fault reporting or storing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error 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/079—Root cause analysis, i.e. error or fault diagnosis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/865—Monitoring of software
Abstract
This application discloses a kind of webpage error message acquisition methods and devices, this method is applied to browser, it include: the webpage interaction data obtained between browser and server, webpage interaction data includes: server feedback to the user's operation data on the webpage that the browser shows of web data and user of the browser;Error detection is carried out to the webpage interaction data according to preset type of error corresponding error trap rule;If detecting webpage mistake based on the webpage interaction data, according to the corresponding location of mistake rule of type of error belonging to the webpage mistake, the wrong source information for leading to the webpage mistake is obtained;By the type of error of the webpage mistake and the error source information reporting to rear end equipment.The scheme of the application can find existing webpage error message during user accesses webpage in time.
Description
Technical field
This application involves web application technical field more particularly to a kind of webpage error message acquisition methods and device.
Background technique
After webpage completes exploitation, tester can test webpage, to detect in page script operational process
Institute's mistake that may be present, to reduce webpage mistake.
But after the webpage of website comes into operation, during user accesses the webpage of website, but often it will appear
The mistake that can not be found in some test process.However, present in during how finding user's access webpage in time
Error message is those skilled in the art's technical problem in the urgent need to address.
Summary of the invention
In view of this, this application provides a kind of webpage error message acquisition methods and device, to find that user visits in time
Error message present in asking webpage in the process, to be conducive to the situation for finding in time and solving to lead to webpage mistake.
To achieve the above object, on the one hand, this application provides a kind of webpage error message acquisition methods, are applied to browsing
Device, comprising:
The webpage interaction data between browser and server is obtained, the webpage interaction data includes: server feedback
The user's operation data of web data and user on the webpage that the browser shows to the browser;
Error detection is carried out to the webpage interaction data according to preset type of error corresponding error trap rule;
If webpage mistake is detected based on the webpage interaction data, according to type of error belonging to the webpage mistake
Corresponding location of mistake rule, obtains the wrong source information for leading to the webpage mistake;
By the type of error of the webpage mistake and the error source information reporting to rear end equipment.
Preferably, described that the webpage interaction data is carried out according to preset type of error corresponding error trap rule
Error detection, comprising:
According to the error label of preset resource loading error, detecting, which whether there is in the webpage interaction data, belongs to money
The error label of source loading error, there are resource loading errors for characterizing for the error label;
If described detect webpage mistake based on the webpage interaction data, according to mistake belonging to the webpage mistake
The corresponding location of mistake rule of type, obtains the wrong source information for leading to the webpage mistake, comprising:
If detecting the error label of resource loading error in the webpage interaction data, pass through operation page chain
It connects capture function and obtains the page link that the resource loading error occurs, and function is captured by operation resource link and obtains hair
The link information of the resource of the raw resource loading error.
Preferably, described that the webpage interaction data is carried out according to preset type of error corresponding error trap rule
Error detection, comprising:
According to the extremely corresponding request exception catching function of preset network request, detecting in the webpage interaction data is
It is no to there is the status code for belonging to network request exception;
If described detect webpage mistake based on the webpage interaction data, according to mistake belonging to the webpage mistake
The corresponding location of mistake rule of type, obtains the wrong source information for leading to the webpage mistake, comprising:
In the case where status code of the request exception catching function check to characterization network request exception, by described
Exception catching function is requested to obtain the first error code position, first error code position is to cause the network request different
The position of normal code;
By call back function intercept and capture it is described request exception catching function obtain network request exception status code with
And first error code position.
Preferably, if described detect webpage mistake based on the webpage interaction data, according to the webpage mistake institute
The corresponding location of mistake rule of the type of error of category, obtains the wrong source information for leading to the webpage mistake, further includes:
In the status code of the request exception catching function check to characterization network request exception, and it is different by the request
Often first error code position has not been obtained in capture function, then passes through the corresponding readjustment letter of the request exception catching function
Number intercepts and captures the status code for the network request exception that the exception catching function obtains.
Preferably, described that the webpage interaction data is carried out according to preset type of error corresponding error trap rule
Error detection, further includes:
Function is captured by preset run-time error, and the detection of web page code run-time error is carried out to the webpage interaction data;
If described detect webpage mistake based on the webpage interaction data, according to mistake belonging to the webpage mistake
The corresponding location of mistake rule of type, obtains the wrong source information for leading to the webpage mistake, further includes:
If the run-time error captures function check to web page code run-time error, letter is captured by the run-time error
The corresponding call back function of number obtains the web page code run-time error and the second mistake that the run-time error capture function captures
Code position, second error code position are that there are the code positions of web page code run-time error.
Another aspect, present invention also provides a kind of webpage error message acquisition device, are applied to browser, comprising:
Data capture unit, for obtaining the webpage interaction data between browser and server, the webpage interaction number
According to include: server feedback to the browser user on the webpage that the browser shows of web data and user
Operation data;
Error detection units, for interacting number to the webpage according to the preset corresponding error trap rule of type of error
According to progress error detection;
Error source acquiring unit, if for detecting webpage mistake based on the webpage interaction data, according to the net
The corresponding location of mistake rule of type of error belonging to page mistake, obtains the wrong source information for leading to the webpage mistake;
Mistake reporting unit, for setting the type of error of the webpage mistake and the error source information reporting to rear end
It is standby.
Preferably, the error detection units, comprising:
First error detection units detect the webpage and hand over for the error label according to preset resource loading error
With the presence or absence of the error label for belonging to resource loading error in mutual data, there are resource load is wrong for characterizing for the error label
Accidentally;
The error source acquiring unit, comprising:
First error source acquiring unit, if for detecting the mistake of resource loading error in the webpage interaction data
Accidentally label then captures function acquisition by operation page link and the page link of the resource loading error occurs, and passes through fortune
Row resource link captures function and obtains the link information that the resource of the resource loading error occurs.
Preferably, the error detection units, comprising:
Second error detection units, for according to the extremely corresponding request exception catching function of preset network request, inspection
It surveys in the webpage interaction data with the presence or absence of the status code for belonging to network request exception;
The error source acquiring unit, comprising:
Second error source acquiring unit, in the request exception catching function check to characterization network request exception
In the case where status code, the first error code position, first error code are obtained by the request exception catching function
Position is the position for leading to the code of the network request exception;
First error source intercepts and captures unit, for being intercepted and captured described in the request exception catching function acquisition by call back function
The status code of network request exception and first error code position.
Preferably, the error source acquiring unit, further includes:
Second error source intercepts and captures unit, in the request exception catching function check to characterization network request exception
Status code, and first error code position is had not been obtained by the request exception catching function, then pass through the request
The corresponding call back function of exception catching function intercepts and captures the status code for the network request exception that the exception catching function obtains.
Preferably, the error detection units, further includes:
Third error detection units carry out the webpage interaction data for capturing function by preset run-time error
The detection of web page code run-time error;
The error source acquiring unit, further includes:
Third error source intercepts and captures unit, if capturing function check to web page code for the run-time error
Run-time error captures the corresponding call back function of function by the run-time error and obtains the operation mistake
The web page code run-time error and the second error code position that error capture function captures, described
Two error code positions are that there are the code positions of web page code run-time error.
It can be seen via above technical scheme that the net in the application between the available browser of browser and server
Page interaction data can find that user accesses appeared in webpage by carrying out error detection to webpage interaction data in time
Webpage mistake, moreover, after detecting webpage mistake, it can also be according to the matched location of mistake of type of error of webpage mistake
Rule obtains the wrong source information for leading to webpage mistake, so that browser will can be deposited during web page access in time
Webpage mistake and error source information reporting to rear end equipment, so that developer can be had found in time by rear end equipment
Existing various mistakes and wrong source information, are conducive to find and solve webpage mistake in time during user's access webpage
Situation.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 shows a kind of a kind of flow diagram of page fault information acquisition methods of the application;
Fig. 2 shows a kind of another flow diagrams of page fault information acquisition methods of the application;
Fig. 3 shows a kind of another flow diagram of webpage error message acquisition methods of the application;
Fig. 4 shows a kind of a kind of composed structure schematic diagram of webpage error message acquisition device of the application.
Specific embodiment
The scheme of the embodiment of the present application is suitable for obtaining generated webpage error message during web page access, with advantageous
It finds in time and solves webpage mistake.
The scheme of the application is introduced with reference to the accompanying drawing.
Such as Fig. 1, it illustrates a kind of a kind of flow diagram of webpage error message acquisition methods of the application, the application's
Scheme is applied to browser, and the present embodiment may include:
S101 obtains the webpage interaction data between browser and server.
Wherein, webpage interaction data includes: web data of the server feedback to the browser, and, user is browsing
User's operation data on the webpage that device shows etc..
Wherein, server feedback to the web data of browser includes the source code of webpage and during webpage shows
Some pop-up data etc. data relevant to webpage.
The user's operation data may include: object corresponding to the concrete operations that user is carried out and operation, e.g., brush
The inputs operation such as button or finger sliding is clicked in the operation of new page.It can also include the user information of input operation, e.g.,
User name, user right and the login time of user etc. information.
Optionally, user's operation data can also include the user's operation detected on the webpage shown on browser
The operation screenshot for operating the click on screenshot, such as webpage, touching sliding user's operation.
It is understood that the webpage mistake occurred during user accesses the webpage of server by browser
It can reflect out by the data of the interaction between server and browser, therefore, the application obtains webpage interaction
Data may be implemented more comprehensively to find existing webpage mistake during web page access.
Wherein, obtain the webpage interaction data between browser and server mode can there are many, e.g., one kind can
It selects in implementation, JS (JavaScript) script file is preset in browser, be somebody's turn to do by the way that the JS script file is available
Webpage interaction data.
S102 carries out wrong inspection to the webpage interaction data according to the preset corresponding error trap rule of type of error
It surveys.
Such as, in the case where browser presets JS script file, can in the JS script file preset wrong class
The corresponding error trap rule of type.
It is understood that considering that webpage mistake appeared in the webpage process of access server can there are many can
The type of energy therefore, can be with preset a variety of differences in step S102 in order to more fully capture different types of webpage mistake
The corresponding error trap rule of type of error.
Such as, it is a kind of may in the case where, it is contemplated that during web page access, a kind of relatively conventional type of error is net
There is resource loading error in page, it, therefore, can be with for example, occur the loading error of the resources such as picture, video, document in webpage
The corresponding error trap rule of preset resource loading error.Such as, the error label of preset resource loading error is based on this, can be with
With the presence or absence of the error label for belonging to resource loading error in detection webpage interaction data, if it is present confirmation detects money
Source loading error.
In the case where another is possible, the type of error of webpage mistake can be abnormal for network request.Network request is different
Interface requests mistake when the requesting page server face Chang Weixiang, interface requests mistake when the operation pages being commonly called as.Such as, network request is different
It often may include: characterization there is no the network request exception for linking corresponding webpage, that is, 404 mistakes being commonly called as;And characterization by
The network access exception caused by server mistake, that is, 500 mistakes being commonly called as can also include that the network requests such as 400 mistakes are different
Often etc..In that case, can be with the extremely corresponding status code of preset network request, and detect in network interaction data and whether deposit
In the status code of network request exception.Such as, status code can be 404 (perhaps 404 mistake) 500 (or 500 mistakes) etc..
Optionally, which can be detected by the request exception catching function of capture network request exception
In with the presence or absence of characterization network request exception status code, if there is status code, then it represents that there are the status code expression net
Network request is abnormal.
In the case where another is possible, the type of error of webpage mistake may include: web page code run-time error, specifically
May include code syntax mistake, code logic mistake etc., such mistake in webpage test process it has also been discovered that, but
It, can also such preset wrong error detection rule in order to avoid test does not detect corresponding mistake.
It optionally, can be preset on the basis of other preset corresponding error detections of at least one webpage mistake are regular
The corresponding error detection rule of this kind of web page code run-time error.Such as, function, the run-time error can be captured with preset run-time error
Capturing function can be the global error trap function in JS file.Correspondingly, capturing function to net by the run-time error
Page interaction data carries out the detection of web page code run-time error, to determine web page code run-time error based on webpage interaction data.
Certainly, in practical applications, webpage mistake can also have other type of errors, and the application is without restriction to this.
S103, if webpage mistake is detected based on the webpage interaction data, according to wrong class belonging to the webpage mistake
The corresponding location of mistake rule of type, obtains the wrong source information for leading to the webpage mistake.
Wherein, which causes the source information of the webpage mistake e.g. to lead to webpage mistake for determination
Resource link, web page interlinkage or code position etc..
It is understood that being directed to different types of webpage mistake, which be would also vary from, below with
In case where above-mentioned several webpage mistakes, several possible situations for obtaining wrong source information are introduced.
Such as, in the case where a kind of possible, in the case where the type of error of webpage mistake is resource loading error, if
The error label of resource loading error is detected in the webpage interaction data, then function is captured by operation page link and obtained
The page link of the resource loading error occurs, and captures function by operation resource link and obtains and the resource loading error occurs
Resource link information.
Wherein, page link of the page link capture function for the page corresponding to locating resource loading error.And it is somebody's turn to do
Resource link captures link information corresponding to resource of the function for locating resource loading error, such as the feelings of picture loading error
Under condition, then the link of picture is obtained.
In the case where another is possible, in the case where the type of error of webpage mistake is network request exception, logical
In the case where crossing request exception catching function check to the status code for characterizing network request exception, pass through the request exception catching letter
Number obtains the first error code position.Wherein, which is the position for leading to the code of network request exception
It sets;Then, the status code of the network request exception of request exception catching function acquisition is intercepted and captured by call back function and is somebody's turn to do
First error code position.
For another example, for web page code run-time error, by the call back function being arranged in the error trap function, if fortune
Row error trap function check can capture run-time error by call back function and capture function capture to web page code run-time error
The web page code run-time error arrived and the second error code position, wherein the second error code position is that there are web page codes
E.g. the information such as the code row or column of run-time error occur for the code position of run-time error.
S104, by the type of error of the webpage mistake and the error source information reporting to rear end equipment.
By the introduction of several situations in front it is found that when the type difference of webpage mistake, which is included interior
Hold also can difference, in practical applications, browser may detect a kind of webpage mistake with one-time detection, it is also possible to
A variety of webpage mistakes are detected simultaneously by, but every kind for detecting webpage mistake, browser can be by corresponding error sources
Information reporting is to rear end equipment.
Wherein, rear end equipment can be server, can also backstage data storage device etc., the application this is not added limit
System.
It is understood that in order to the mistake for getting the users such as maintenance of netpage personnel by rear end equipment
Accidentally type and wrong source information, quickly solve the particular problem for leading to webpage mistake, and the application can also will test webpage
At the time of mistake and the operation screenshot of user that the moment is truncated to etc. is reported to rear end equipment together.
As it can be seen that the webpage interaction data in the application between the available browser of browser and server, by right
Webpage interaction data carries out error detection, can find that user accesses webpage mistake appeared in webpage in time, moreover, examining
After measuring webpage mistake, webpage can also be led to according to the matched location of mistake rule of type of error of webpage mistake, acquisition
The wrong source information of mistake, so that browser can be in time by webpage mistake and mistake existing during web page access
Accidentally source information is reported to rear end equipment, thus during developer can have found that user accesses webpage by rear end equipment in time
Existing various mistakes and wrong source information, are conducive to the situation for finding and solving webpage mistake in time.
In order to make it easy to understand, being illustrated by taking a kind of acquisition process of webpage mistake as an example by the application, below to obtain
The process of resource loading error and its relevant error source information is introduced.
As shown in Fig. 2, it illustrates a kind of another flow diagram of webpage error message acquisition methods of the application, this
The method of embodiment illustrates that the present embodiment may include: in case where obtaining resource loading error
S201 obtains the webpage interaction data between browser and server.
Wherein, webpage interaction data includes: server feedback to the web data of the browser and user in the browsing
User's operation data on the webpage that device shows.
Certainly, which can also include the operation screenshot of user.Either, although webpage interaction data not
Operation screenshot comprising user obtains the operation screenshot of user while obtaining the webpage interaction data.
S202 is detected in the webpage interaction data according to the error label of preset resource loading error with the presence or absence of category
In the error label of resource loading error.
Wherein, there are resource loading errors for characterizing for the error label.Such as, the error label of resource loading error can be with
Error label including characterizing picture loading error, characterizes the error label etc. of video loading error.
Such as, the resource loading error capture function of capture resource loading error, resource load are prefixed in JS file
Error trap function can detecte with the presence or absence of corresponding error label.For example, a kind of resource loading error capture function can be with
For " window.addEventListerner (' error') ".
S203 passes through operation page if detecting the error label of resource loading error in the webpage interaction data
Face link capture function obtains the page link that the resource loading error occurs, and captures function by operation resource link and obtain
The link information of the resource of the resource loading error occurs.
Optionally, after detecting error label in webpage interaction data, it can also obtain and resource loading error occurs
Element, such as occur resource loading error specific element, such as the element of picture loading error.For example, being loaded for picture wrong
Accidentally, the element that mistake occurs for picture can be obtained by " event.path ".
Wherein, the concrete form of page link capture function can also there are many possibility, e.g., Ke Yiwei
"event.targe.baseURI".Correspondingly, function can also there are many possibility for resource link capture, as the resource link is caught
Obtaining function can be with are as follows: " event.targe.currentSrc ".
The link information of the corresponding page link of resource loading error and resource is sent to rear end equipment by S204.
In the present embodiment, which may include the page link of resource loading error and the link of resource
Information;It is, of course, also possible to include: user's operation screenshot etc..
Fig. 2 is to obtain resource with the preset corresponding error detection rule of resource loading error and error trap rule
Illustrate for the relevant error message of loading error, but for other above-mentioned several mistakes, in addition to detected rule and
Capture rule has difference, and the sequence of detection process is referred to.
It is understood that in view of the application can be with the error detection rule and error trap of preset a variety of webpage mistakes
Rule, meanwhile, error message acquisition methods of the application different type webpage mistake in order to facilitate understanding, below simultaneously to more
For the error message of the network error of seed type is obtained, the scheme of the application is introduced.
As shown in figure 3, it illustrates a kind of processes of another embodiment of webpage error message acquisition methods of the application to show
It is intended to, the method for the present embodiment may include:
S301 interacts number by the webpage between JS file acquisition browser and server preset in operation browser
According to, and intercept the operation screenshot of the user's operation of browser side.
The present embodiment is by taking the JS file acquisition webpage interaction data by running in browser as an example, but for other
Mode is applied equally to the present embodiment.
S302 is detected in the webpage interaction data according to the error label of resource loading error preset in the JS file
With the presence or absence of the error label for belonging to resource loading error.
S303 should by operation if detecting the error label of resource loading error in the webpage interaction data
Page link capture function in JS file obtains the page link that the resource loading error occurs, and by running the JS file
In resource link capture function obtain occur the resource loading error resource link information.
Step S302 and S303 may refer to the related introduction of preceding embodiment, and details are not described herein.
S304, according to the extremely corresponding request exception catching function of network request preset in JS file, detection webpage is handed over
With the presence or absence of the status code for belonging to network request exception in mutual data.
Such as, status code can be the status code of 404,500 etc. characterization network request exceptions.If passing through exception catching letter
Status code of the number in capture webpage interaction data, then it is assumed that there are network request exceptions.
S305, in the case where status code of the request exception catching function check to characterization network request exception, by this
Exception catching function is requested to obtain the first error code position.
Wherein, the first error code position is the position for leading to the code of network request exception.
Such as, request exception catching function can be the ajax request of encapsulation, can detect net by ajax request
When network request is abnormal, throw exception.It, can root by ajax request meanwhile for some Network Abnormals, such as 404 mistakes
According to the interface name that mistake occurs, the place that mistake occurs is found in the page.Certainly, request exception catching function can also include mistake
Accidentally codeacquisition function captures the position that function gets the code of generation mistake by the error code, for example, should passing through
Ajax request can be after detecting network request exception, can be in conjunction with primary in JS file
" window.addEventListener (' error', (msg, url, row, col, error)=> { }) " this function gets
The ranks number of the code of mistake occurs.
Certainly, request it is abnormal obtain function be also possible to window.addEventListener (' error', (msg,
Url, row, col, error), but this kind of mode can not judge the abnormal class of network request exception, in this way 404 or 500
Deng, it is also necessary to it obtains server-side log and carries out investigation analysis.
S306 passes through request exception if getting the first error code position by the request exception catching function
The corresponding call back function of capture function is intercepted and captured the status code of the network request exception of request exception catching function acquisition and is somebody's turn to do
First error code position.
Wherein, call back function can intercept and capture the status code and phase of the Network Abnormal mistake that the exception catching function captures
Close information.
Such as, in the case that request exception catching function is addEventListener, in order to solve the problems, such as cross-domain abduction,
AddEventListener code primary in JS file can be kidnapped, to the readjustment letter in addEventListener code
Number has added one layer of try { } catch () { }, handles in this way, the mistake dished out in call back function can be robbed, browser will not be to misfortune
The exception held carries out cross-domain interception, it is possible to obtain detailed error message.
S307 in the case where status code of the request exception catching function check to characterization network request exception, and passes through
The request exception catching function has not been obtained to the first error code position, then passes through the corresponding readjustment of request exception catching function
Function intercepts and captures the status code of the network request exception of request exception catching function acquisition.
It is understood that if request it is abnormal obtain function be window.addEventListener (' error',
(msg,url,row,col,error);Or network request is 500 etc. extremely, it can not be straight by ajax request and other functions
The code position for getting mistake is obtained, then call back function can directly acquire the status code for requesting exception catching function to get i.e.
Can, it is subsequent again by server according to status code is captured at the time of, the server log for obtaining the corresponding moment is further divided
Analysis.
Certainly, the abnormal function that obtains can also can be kidnapped in that case for the method for console.error
Console.error, to capture the mistake of dished out network request exception.
Wherein, step S304-S306 and step S302-S303 sequence is not limited to shown in Fig. 3, in practical applications,
It can be synchronized while executing step S302-S303 and execute step S304-S306.
S308 captures function by run-time error preset in JS file and carries out web page code operation to webpage interaction data
Error detection.
Such as, in a kind of possible situation, which can capture letter for global error preset in JS file
Number, for example, the error trap function may include: " indow.addEventListener (' error') " and
"window.addEventListener('unhandledrejection".If it is considered that compatible, the error trap function is also
It may include window.onerror.
S309 captures letter by run-time error if the run-time error captures function check to web page code run-time error
The corresponding call back function of number obtains the web page code run-time error that run-time error capture function captures and the second wrong generation
Code position.
Wherein, which is that there are the code positions of web page code run-time error.
Call back function herein be used to kidnap the run-time error web page code run-time error that captures of capture function and
The the second error code position finally oriented.
Certainly, run-time error capture function is dished out web page code run-time error using the method for console.error, at this
In the case of kind, console.error can be kidnapped, to capture dished out web page code run-time error and the second error code position
It sets.
It is understood that step S308 and S309 are also possible to and front S304-S306 and step S302-S303
In any one group be performed simultaneously, the application is without restriction to this.
It is understood that needing to position there are network request exception and web page code run-time error
The code position of mistake occurs, e.g., the row of the code of mistake and/or the information of column occurs.It and is compressed in web page code
In the case where JS file, in order to get the code position that mistake occurs, request exception catching function and fortune can be combined with
It may call upon mapping source-map function in source in row error trap function, finally determine actual code position.Such as, it asks
Lead to first compression offspring's code position that network request is abnormal after asking exception catching function to capture compression in JS file, can adjust
Convert out actual first error code position with the source-map function, obtain physical presence mistake code line or
Column.It is also similar for run-time error capture function.
S310, in the case where detecting webpage mistake, the type of error for the webpage mistake that will acquire, mistake source information
And the operation screenshot of user is sent to rear end equipment.
Wherein, according to the difference of the preceding step S302-309 error message that can be captured, wrong source information herein
The content for being included also difference e.g. can get the page link and money of resource loading error in above step 303
The link information in source, step S307 get status code and the first error code position of network request exception, and step
S309 gets web page code run-time error and the second error code position, then the mistake source information will include: resource load
The page link of mistake and the link information of resource, the status code of network request exception and the first error code position,
And the web page code run-time error and the second error code position.Certainly, in practical applications, the error source got every time
Information may be only one kind of several error messages.
A kind of corresponding webpage error message acquisition methods of the application, present invention also provides a kind of webpage error message acquisitions
Device.As shown in figure 4, it illustrates a kind of flow diagram of webpage error message acquisition device one embodiment of the application,
The method of the present embodiment can be applied to browser, the apparatus may include:
Data capture unit 401, for obtaining the webpage interaction data between browser and server, the webpage interaction
Data include: server feedback to the use on the webpage that the browser shows of web data and user of the browser
Family operation data;
Error detection units 402, for handing over according to the preset corresponding error trap rule of type of error the webpage
Mutual data carry out error detection;
Error source acquiring unit 403, if for detecting webpage mistake based on the webpage interaction data, according to described
The corresponding location of mistake rule of type of error belonging to webpage mistake, obtains the wrong source information for leading to the webpage mistake;
Mistake reporting unit 404, after giving the type of error of the webpage mistake and the error source information reporting
End equipment.
In the case where a kind of possible, the error detection units, comprising:
First error detection units detect the webpage and hand over for the error label according to preset resource loading error
With the presence or absence of the error label for belonging to resource loading error in mutual data, there are resource load is wrong for characterizing for the error label
Accidentally;
The error source acquiring unit, comprising:
First error source acquiring unit, if for detecting the mistake of resource loading error in the webpage interaction data
Accidentally label then captures function acquisition by operation page link and the page link of the resource loading error occurs, and passes through fortune
Row resource link captures function and obtains the link information that the resource of the resource loading error occurs.
In the case where another is possible, the error detection units, comprising:
Second error detection units, for according to the extremely corresponding request exception catching function of preset network request, inspection
It surveys in the webpage interaction data with the presence or absence of the status code for belonging to network request exception;
The error source acquiring unit, comprising:
Second error source acquiring unit, in the request exception catching function check to characterization network request exception
In the case where status code, the first error code position, first error code are obtained by the request exception catching function
Position is the position for leading to the code of the network request exception;
First error source intercepts and captures unit, described in being intercepted and captured by the corresponding call back function of the request exception catching function
The status code for the network request exception for requesting exception catching function to obtain and first error code position.
Optionally, the error source acquiring unit, further includes:
Second error source intercepts and captures unit, in the request exception catching function check to characterization network request exception
Status code, and first error code position is had not been obtained by the request exception catching function, then pass through the request
The corresponding call back function of exception catching function intercepts and captures the status code for the network request exception that the exception catching function obtains.
In the embodiment of apparatus above, the error detection units can also include:
Third error detection units carry out the webpage interaction data for capturing function by preset run-time error
The detection of web page code run-time error;
The error source acquiring unit, further includes:
Third error source intercepts and captures unit, if capturing function check for the run-time error runs mistake to web page code
Accidentally, the corresponding call back function of function is captured by the run-time error and obtains the webpage that the run-time error capture function captures
Code run-time error and the second error code position, second error code position are that there are web page code run-time errors
Code position.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight
Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
For device class embodiment, since it is basically similar to the method embodiment, so being described relatively simple, related place ginseng
See the part explanation of embodiment of the method.
The foregoing description of the disclosed embodiments can be realized those skilled in the art or using the present invention.To this
A variety of modifications of a little embodiments will be apparent for a person skilled in the art, and the general principles defined herein can
Without departing from the spirit or scope of the present invention, to realize in other embodiments.Therefore, the present invention will not be limited
It is formed on the embodiments shown herein, and is to fit to consistent with the principles and novel features disclosed in this article widest
Range.
The above is only the preferred embodiment of the present invention, it is noted that those skilled in the art are come
It says, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should be regarded as
Protection scope of the present invention.
Claims (10)
1. a kind of webpage error message acquisition methods, which is characterized in that be applied to browser, comprising:
The webpage interaction data between browser and server is obtained, the webpage interaction data includes: server feedback to institute
State the user's operation data of the web data and user of browser on the webpage that the browser shows;
Error detection is carried out to the webpage interaction data according to preset type of error corresponding error trap rule;
It is corresponding according to type of error belonging to the webpage mistake if detecting webpage mistake based on the webpage interaction data
Location of mistake rule, obtaining leads to the wrong source information of the webpage mistake;
By the type of error of the webpage mistake and the error source information reporting to rear end equipment.
2. webpage error message acquisition methods according to claim 1, which is characterized in that described according to preset wrong class
The corresponding error trap rule of type carries out error detection to the webpage interaction data, comprising:
According to the error label of preset resource loading error, detects in the webpage interaction data and add with the presence or absence of belonging to resource
The error label of mistake is carried, there are resource loading errors for characterizing for the error label;
If described detect webpage mistake based on the webpage interaction data, according to type of error belonging to the webpage mistake
Corresponding location of mistake rule, obtains the wrong source information for leading to the webpage mistake, comprising:
If detecting the error label of resource loading error in the webpage interaction data, caught by running page link
It obtains function and obtains the page link that the resource loading error occurs, and capture function by operation resource link and obtain and institute occurs
State the link information of the resource of resource loading error.
3. webpage error message acquisition methods according to claim 1, which is characterized in that described according to preset wrong class
The corresponding error trap rule of type carries out error detection to the webpage interaction data, comprising:
According to the extremely corresponding request exception catching function of preset network request, detects and whether deposited in the webpage interaction data
In the status code for belonging to network request exception;
If described detect webpage mistake based on the webpage interaction data, according to type of error belonging to the webpage mistake
Corresponding location of mistake rule, obtains the wrong source information for leading to the webpage mistake, comprising:
In the case where status code of the request exception catching function check to characterization network request exception, pass through the request
Exception catching function obtains the first error code position, and first error code position is to cause the network request abnormal
The position of code;
Status code and the institute of the network request exception that the request exception catching function obtains are intercepted and captured by call back function
State the first error code position.
4. webpage error message acquisition methods according to claim 3, which is characterized in that if described be based on the webpage
Interaction data detects webpage mistake, according to the corresponding location of mistake rule of type of error belonging to the webpage mistake, obtains
Lead to the wrong source information of the webpage mistake, further includes:
It is caught extremely in the status code of the request exception catching function check to characterization network request exception, and by the request
It obtains function and first error code position has not been obtained, then cut by the corresponding call back function of the request exception catching function
Obtain the status code for the network request exception that the exception catching function obtains.
5. webpage error message acquisition methods according to claim 2 or 3, which is characterized in that described according to preset mistake
Accidentally the corresponding error trap rule of type carries out error detection to the webpage interaction data, further includes:
Function is captured by preset run-time error, and the detection of web page code run-time error is carried out to the webpage interaction data;
If described detect webpage mistake based on the webpage interaction data, according to type of error belonging to the webpage mistake
Corresponding location of mistake rule, obtains the wrong source information for leading to the webpage mistake, further includes:
If the run-time error captures function check to web page code run-time error, function pair is captured by the run-time error
The call back function answered obtains the web page code run-time error and the second error code that the run-time error capture function captures
Position, second error code position are that there are the code positions of web page code run-time error.
6. a kind of webpage error message acquisition device, which is characterized in that be applied to browser, comprising:
Data capture unit, for obtaining the webpage interaction data between browser and server, the webpage interaction data packet
It includes: web data and user user's operation on webpage that the browser show of the server feedback to the browser
Data;
Error detection units, for according to the preset corresponding error trap rule of type of error to the webpage interaction data into
Row error detection;
Error source acquiring unit, if for detecting webpage mistake based on the webpage interaction data, it is wrong according to the webpage
The corresponding location of mistake rule of type of error belonging to accidentally, obtains the wrong source information for leading to the webpage mistake;
Mistake reporting unit, for by the type of error of the webpage mistake and the error source information reporting to rear end equipment.
7. webpage error message acquisition device according to claim 6, which is characterized in that the error detection units, packet
It includes:
First error detection units detect the webpage interaction number for the error label according to preset resource loading error
With the presence or absence of the error label for belonging to resource loading error in, there are resource loading errors for characterizing for the error label;
The error source acquiring unit, comprising:
First error source acquiring unit, if for detecting the mistake mark of resource loading error in the webpage interaction data
Label then capture the page link that the resource loading error occurs for function acquisition by operation page link, and pass through operation money
Linking sources capture function and obtain the link information that the resource of the resource loading error occurs.
8. webpage error message acquisition device according to claim 6, which is characterized in that the error detection units, packet
It includes:
Second error detection units, for detecting institute according to the extremely corresponding request exception catching function of preset network request
It states in webpage interaction data with the presence or absence of the status code for belonging to network request exception;
The error source acquiring unit, comprising:
Second error source acquiring unit, for the state in the request exception catching function check to characterization network request exception
In the case where code, the first error code position, first error code position are obtained by the request exception catching function
For cause the network request exception code position;
First error source intercepts and captures unit, for intercepting and capturing the network that the request exception catching function obtains by call back function
Request abnormal status code and first error code position.
9. webpage error message acquisition device according to claim 8, which is characterized in that the error source acquiring unit,
Further include:
Second error source intercepts and captures unit, for the state in the request exception catching function check to characterization network request exception
Code, and first error code position is had not been obtained by the request exception catching function, then it is abnormal by the request
The corresponding call back function of capture function intercepts and captures the status code for the network request exception that the exception catching function obtains.
10. webpage error message acquisition device according to claim 7 or 8, which is characterized in that the error detection list
Member, further includes:
Third error detection units carry out webpage to the webpage interaction data for capturing function by preset run-time error
The detection of code run-time error;
The error source acquiring unit, further includes:
Third error source intercepts and captures unit, if capturing function check to web page code run-time error for the run-time error, leads to
It crosses the corresponding call back function of the run-time error capture function and obtains the web page code that the run-time error capture function captures
Run-time error and the second error code position, second error code position are that there are the codes of web page code run-time error
Position.
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 true CN110287056A (en) | 2019-09-27 |
CN110287056B 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) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111026637A (en) * | 2019-10-22 | 2020-04-17 | 苏宁云计算有限公司 | 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 |
CN111782464A (en) * | 2020-06-22 | 2020-10-16 | 北京异乡旅行网络科技有限公司 | Webpage dynamic abnormity 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 |
CN112671615A (en) * | 2020-12-29 | 2021-04-16 | 中国平安财产保险股份有限公司 | Method, system and storage medium for collecting operation behavior data of front-end user |
CN113553272A (en) * | 2021-09-18 | 2021-10-26 | 深圳市信润富联数字科技有限公司 | Interface abnormity monitoring method, device, medium and computer program product |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080320343A1 (en) * | 2007-06-20 | 2008-12-25 | Microsoft Corporation | Web page error reporting |
CN102739663A (en) * | 2012-06-18 | 2012-10-17 | 奇智软件(北京)有限公司 | Detection method and scanning engine of web pages |
CN105354126A (en) * | 2015-10-13 | 2016-02-24 | 金蝶软件(中国)有限公司 | Method and device for monitoring exception in page script file |
CN105468511A (en) * | 2014-09-05 | 2016-04-06 | 阿里巴巴集团控股有限公司 | Web page script error positioning method and apparatus |
CN105468587A (en) * | 2014-05-30 | 2016-04-06 | 北京奇虎科技有限公司 | Webpage anomaly monitoring method and apparatus |
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 |
-
2019
- 2019-07-04 CN CN201910599613.4A patent/CN110287056B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080320343A1 (en) * | 2007-06-20 | 2008-12-25 | Microsoft Corporation | Web page error reporting |
CN102739663A (en) * | 2012-06-18 | 2012-10-17 | 奇智软件(北京)有限公司 | Detection method and scanning engine of web pages |
CN105468587A (en) * | 2014-05-30 | 2016-04-06 | 北京奇虎科技有限公司 | Webpage anomaly monitoring method and apparatus |
CN105468511A (en) * | 2014-09-05 | 2016-04-06 | 阿里巴巴集团控股有限公司 | Web page script error positioning method and apparatus |
CN105354126A (en) * | 2015-10-13 | 2016-02-24 | 金蝶软件(中国)有限公司 | Method and device for monitoring exception 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 |
Non-Patent Citations (1)
Title |
---|
刘群;马丽艳;郭子平;: "Web应用程序截获数据库错误信息的方法" * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111026637A (en) * | 2019-10-22 | 2020-04-17 | 苏宁云计算有限公司 | 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 |
CN111782464A (en) * | 2020-06-22 | 2020-10-16 | 北京异乡旅行网络科技有限公司 | Webpage dynamic abnormity monitoring method and system |
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 |
CN112671615A (en) * | 2020-12-29 | 2021-04-16 | 中国平安财产保险股份有限公司 | Method, system and storage medium for collecting operation behavior data of front-end user |
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 |
Also Published As
Publication number | Publication date |
---|---|
CN110287056B (en) | 2023-04-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110287056A (en) | Webpage error message acquisition methods and device | |
US10528454B1 (en) | Intelligent automation of computer software testing log aggregation, analysis, and error remediation | |
US8667147B2 (en) | Monitoring related content requests | |
CN104348803B (en) | Link kidnaps detection method, device, user equipment, Analysis server and system | |
CN105354126B (en) | Monitor method and apparatus abnormal in page script file | |
US9740991B2 (en) | Calculating in-flight metrics for non-interruptible business transactions | |
US20110258609A1 (en) | Method and system for software defect reporting | |
CN108696481A (en) | leak detection method and device | |
Xu et al. | Heuristics-based strategies for resolving context inconsistencies in pervasive computing applications | |
US10775751B2 (en) | Automatic generation of regular expression based on log line data | |
CN109559121B (en) | Transaction path call exception analysis method, device, equipment and readable storage medium | |
CN108039956A (en) | Using monitoring method, system and computer-readable recording medium | |
Kupoluyi et al. | Muzeel: Assessing the impact of javascript dead code elimination on mobile web performance | |
CN107395651A (en) | Service system and information processing method | |
Chen et al. | Automatic Root Cause Analysis via Large Language Models for Cloud Incidents | |
CN109828920A (en) | A kind of log analysis method, device and computer readable storage medium | |
CN109492403A (en) | A kind of leak detection method and device | |
JP3897897B2 (en) | TROUBLESHOOTING DEVICE AND TROUBLESHOOTING METHOD IN A NETWORK COMPUTING ENVIRONMENT AND COMPUTER-READABLE RECORDING MEDIUM CONTAINING TROUBLESHOOTING PROGRAM | |
US7653742B1 (en) | Defining and detecting network application business activities | |
CN107026854A (en) | Validating vulnerability method and device | |
Seifermann | Application performance monitoring in microservice-based systems | |
CN107368399A (en) | Webpage monitoring method and system on a kind of line | |
CN116010254A (en) | Performance detection method and system in system research and development stage | |
US20150326677A1 (en) | Screen information collecting computer, screen information collecting method, and computer-readable storage medium | |
CN109361674A (en) | Bypass stream data detection method, device and the electronic equipment of access |
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 |