CN114185742A - Webpage monitoring method, device, equipment and storage medium - Google Patents

Webpage monitoring method, device, equipment and storage medium Download PDF

Info

Publication number
CN114185742A
CN114185742A CN202111520756.5A CN202111520756A CN114185742A CN 114185742 A CN114185742 A CN 114185742A CN 202111520756 A CN202111520756 A CN 202111520756A CN 114185742 A CN114185742 A CN 114185742A
Authority
CN
China
Prior art keywords
monitoring
webpage
web page
target
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.)
Pending
Application number
CN202111520756.5A
Other languages
Chinese (zh)
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.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202111520756.5A priority Critical patent/CN114185742A/en
Publication of CN114185742A publication Critical patent/CN114185742A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Transfer Between Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the technical field of software monitoring, and provides a webpage monitoring method, a device, equipment and a storage medium, wherein the method comprises the following steps: calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document; judging whether the target webpage is normally opened or not; after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser, and monitoring the webpage on a user-perceivable layer. The application also relates to a block chain technology, and the webpage document and the monitoring result can be stored in a block chain node.

Description

Webpage monitoring method, device, equipment and storage medium
Technical Field
The present application relates to the field of software monitoring technologies, and in particular, to a method, an apparatus, a device, and a storage medium for monitoring a web page.
Background
Currently, monitoring a system is generally performed from the perspective of operation and maintenance and service, that is, based on monitoring a server state, a service interface state, a link state, and the like, information such as the server state, the link state, the interface condition, and the like can be obtained. However, there is no way to fully perceive the actual use feeling of the user through the information of the server status, the link status, and the interface status. For example, if it is found that the memory usage rate of the host a is high, only whether the memory of the host is degraded or not is concerned, but actually, the user may temporarily fail to load data due to the high memory usage rate of the host a, so that the user experience is affected, which is not ascertained by the current monitoring. That is, currently, web page monitoring is not performed on the aspects of whether the loading time of the front-end web page resource is normal, whether the front-end web page resource is completely displayed, whether the back-end web page data is normally output, and the like from the perspective of a user.
Therefore, how to monitor the web page at the user perceivable layer becomes an urgent problem to be solved.
Disclosure of Invention
The application provides a webpage monitoring method, a webpage monitoring device, webpage monitoring equipment and a webpage monitoring storage medium, and aims to realize webpage monitoring on a user perceivable layer.
In order to achieve the above object, the present application provides a web page monitoring method, where the web page monitoring method includes:
calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document;
judging whether the target webpage is normally opened or not;
and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
In addition, in order to achieve the above object, the present application further provides a web page monitoring apparatus, including:
the webpage access module is used for calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document;
the webpage monitoring module is used for judging whether the target webpage is normally opened; and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
In addition, to achieve the above object, the present application also provides a computer device comprising a memory and a processor;
the memory for storing a computer program;
the processor is configured to execute the computer program and implement the above-mentioned web page monitoring method when executing the computer program.
In addition, to achieve the above object, the present application further provides a computer readable storage medium storing a computer program, which when executed by a processor, implements the steps of the above-mentioned web page monitoring method.
The application discloses a webpage monitoring method, a device, equipment and a storage medium, a webpage document corresponding to a target webpage to be monitored is obtained by calling a headless browser, the target webpage is accessed based on the webpage document, after the target webpage is normally opened, at least one webpage monitoring item (at least one of a webpage front-end resource loading condition and a webpage rear-end data output condition) corresponding to the headless browser is pre-configured based on the headless browser, the at least one webpage monitoring item corresponding to the target webpage is monitored through the headless browser, the webpage front-end resource loading condition, the webpage rear-end data output condition and other aspects are monitored, a user can directly know the webpage monitoring condition, and the webpage monitoring from a user-perceivable layer is also realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram illustrating steps of a method for monitoring a web page according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a step of monitoring at least one web page monitoring item corresponding to the target web page through the headless browser according to an embodiment of the present application;
FIG. 3 is a schematic flow chart diagram illustrating steps of another method for monitoring web pages according to an embodiment of the present application;
fig. 4 is a schematic diagram of a setting interface of an account management system according to an embodiment of the present disclosure;
FIG. 5 is a schematic flow chart diagram illustrating steps of another method for monitoring web pages according to an embodiment of the present application;
fig. 6 is a schematic block diagram of a web page monitoring apparatus according to an embodiment of the present application;
fig. 7 is a schematic block diagram of a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
The embodiment of the application provides a webpage monitoring method, a webpage monitoring device, webpage monitoring equipment and a webpage monitoring storage medium, which are used for monitoring a webpage on a user-perceivable layer.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a web page monitoring method according to an embodiment of the present application. The method can be applied to computer equipment, and the application scene of the method is not limited in the application. The following describes the web page monitoring method in detail by taking the application of the web page monitoring method to computer equipment as an example.
As shown in fig. 1, the web page monitoring method specifically includes steps S101 to S103.
S101, calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document.
Among them, headless browsers include but are not limited to the PhantomJS browser. The following explains the web page monitoring method by taking the headless browser as a PhantomJS browser as an example.
The PhantomJS browser is a webkit (open browser engine) kernel-based Headless (Headless, operating with scripts) browser. Any thing that can be done in a webkit-based browser (such as google browser), the PhantomJS browser can do. The PhantomJS browser is not only an invisible browser, but also provides operations such as CSS (Cascading Style Sheets) selector, support Web standard, DOM (Document Object Model) operation, JSON (JavaScript Object Notation), JSON Object Notation), HTML5 (hypertext Markup Language), Canvas (Canvas), SVG (Scalable Vector Graphics), and the like, and also provides operations for processing file I/O (Input/Output), thereby realizing that files can be read from and written to an operating system. In this embodiment, web page monitoring is implemented by the PhantomJS browser.
Illustratively, before web page monitoring is performed by the PhantomJS browser, the PhantomJS browser is installed on any host that can access a target web page to be monitored. It should be noted that the host capable of normally accessing the target web page to be monitored may be any operating system as long as the host can access the target web page to be monitored on the network and can support installing and running the PhantomJS browser.
And initializing the PhantomJS browser, and performing configuration operation related to webpage monitoring. Illustratively, a cache and a cookie corresponding to the PhantomJS browser are opened, and one or more webpage monitoring items corresponding to the webpage monitoring are configured. That is, one or more monitoring aspects of monitoring the web page through the PhantomJS browser are configured.
Illustratively, the one or more web page monitoring items corresponding to web page monitoring include at least one of a web page front end resource loading condition and a web page back end data output condition, where the web page front end resource loading condition includes, but is not limited to, a page loading time, a picture loading time, a CSS loading time, whether picture display is complete, whether CSS access is successful, and the like, and the web page back end data output condition includes, but is not limited to, whether web page back end data is normally output, and the like. That is, the configuration monitors the aspects of page loading time, picture loading time, CSS loading time, whether picture display is complete, whether data at the back end of the web page is normally output, and the like.
Illustratively, besides configuring one or more webpage monitoring items corresponding to webpage monitoring, the webpage screenshot function configuration of the PhantomJS browser is also performed.
For example, in addition to the above configuration, a dynamic data monitoring configuration may be performed, and at the same time, a normal data threshold range corresponding to the data may be defined. The dynamic data monitoring can judge whether the data are output normally or not, and can judge whether the data are abnormal or not. Illustratively, the data to be searched can be directly located through a page element searching method of the PhantomJS browser, and dynamic data monitoring is performed.
For example, defining that a normal data threshold range corresponding to certain service data is from a to B, monitoring the service data, and when the service data is not acquired by service data monitoring or the service data is not in the normal data threshold range, judging that the service data is abnormal, and further sending an alarm.
Illustratively, a function monitoring of a mouse click event may be further defined, and whether some button functions are normal, whether response time is normal, etc. may be monitored by using the mouse click event of the PhantomJS browser.
Illustratively, a mouse click event is implemented by a click event of a PhantomJS browser, for example, assuming that # id ═ su "is a certain search button and click () is a simulated click, a mouse click event function monitor can be defined as: fine _ element _ by _ id ("su"). click ().
After the PhantomJS browser is configured, the monitoring of the webpage on a layer which can be sensed by the user can be realized through the configured PhantomJS browser.
If a certain web page needs to be monitored currently, for convenience of description, the web page to be monitored is hereinafter referred to as a target web page.
For example, when the target webpage www.xxx.com needs to be monitored, the web document corresponding to the target webpage www.xxx.com, that is, the web document, is obtained by accessing through the application program interface API of the PhantomJS browser, and the target webpage www.xxx.com is accessed by operating the web document.
S102, judging whether the target webpage is normally opened or not; if yes, go to step S103; if not, returning to execute the step S101;
s103, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
Illustratively, a status () method is used to directly determine whether the target web page is normally open.
In some embodiments, after determining whether the target webpage is normally opened, outputting a webpage opening result indicating whether the target webpage is normally opened. The webpage opening result comprises webpage opening success and webpage opening failure.
Illustratively, a webpage opening result indicating whether the target webpage is normally opened is output using the console. For example, a page open result of whether the target page is normally open is output in the form of a log using the console.
If the target webpage fails to be opened, the target webpage is revisited, and the specific operation is as described in step S101, which is not described herein again.
In other embodiments, if the target webpage fails to be opened, the monitoring operation on the target webpage may also be directly ended.
After the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage based on preset webpage monitoring items such as page loading time, picture loading time, CSS loading time, whether picture display is complete, whether CSS access is successful, whether webpage back end data are normally output and the like.
In some embodiments, after monitoring at least one of the web page monitoring items corresponding to the target web page, a monitoring result of monitoring at least one of the web page monitoring items corresponding to the target web page is output. For example, the corresponding monitoring result is output using the console.
In some embodiments, in addition to actively reporting and outputting the monitoring result, a monitoring result viewing control may be configured in the PhantomJS browser in advance, and the user may actively view the monitoring result of the target webpage based on the PhantomJS browser by clicking the control.
In some embodiments, after the target webpage is normally opened, the user name and password text box is assigned through the PhantomJS browser, and the user account input operation of the user on the target webpage is simulated. Illustratively, using a click () event simulates a user clicking a login button to perform a login operation. Likewise, the account login result is output using the console.
And when the user account is successfully logged in, acquiring service data corresponding to the user account through the PhantomJS browser, and outputting the service data. Illustratively, the retrieved service data is output by using the console by directly locating to the service data through getElementById ().
Illustratively, the following monitoring method of accessing a certain web page is performed:
// open a Web Page
var page=require('webpage').create();
var url='http://www.xxx.com/login'
page.open(url,function(){
if(status!=='success'){
Console.1og ('web page open success!');
ret=page.evaluate(function(){
v/enter user password and log on
S("#username")[0].value='acdmin'
S("#password")[0].value='acdmin'
$("#submit").click();
Console.1og ('user login success!');
v/obtaining the value of the service data A
return
document.getElementById('a_data').textContent;
console.1og ('business data a value is' + ret);
}
else{
console.1og ('web page open failure!');
}
}};
that is, whether the opening of the web page is successful or not, whether the login of the user is successful or not, and the service data a are monitored, and monitoring results such as "success/failure of opening of the web page www.xxx.com", "success/failure of login of the user password", and "the value of the service data a is xxx" are output.
In some embodiments, for example, monitoring the page loading time corresponding to the target webpage is performed, as shown in fig. 2, step S103 may include sub-steps S1031 to S1033.
And S1031, timing page loading time corresponding to the target webpage through the headless browser.
Illustratively, when the page loading starts, the current first time t1 is obtained. For example, a method such as Var t1 date now () is implemented. When the page loading is completed, the current second time t2 is obtained. For example, a method such as Var t2 date now () is implemented. Then, from the first time t1 and the second time t2, the page load time t can be calculated as: t is t2-t 1.
S1032, if the page loading time is smaller than or equal to a preset time threshold, determining that the page loading time is normal;
s1033, if the page loading time is larger than the preset time threshold, determining that the page loading time is abnormal.
And after the page loading time T is obtained, comparing the page loading time T with a preset time threshold T corresponding to the preset normal page loading. And if the page loading time T is less than or equal to the preset time threshold T, determining that the page loading time is normal. Otherwise, if the page loading time T is greater than the preset time threshold value T, determining that the page loading time is abnormal.
The above is an example of monitoring the page loading time corresponding to the target webpage, and the operation of monitoring the loading time of various front-end resources such as css, pictures and the like corresponding to the target webpage can refer to monitoring the page loading time, so that details are not repeated.
Illustratively, after monitoring at least one webpage monitoring item corresponding to the target webpage, a monitoring result for monitoring the at least one webpage monitoring item corresponding to the target webpage is output.
For example, if the page loading time is monitored and determined to be normal, outputting a monitoring result if the page loading time is xx seconds and is within a normal range; if the page loading time is monitored, and the page loading time is determined to be abnormal, outputting a monitoring result if the page loading time is xx seconds and is within the abnormal range.
For example, taking monitoring whether the CSS access corresponding to the target web page is successful as an example, the following CSS access success monitoring method is performed:
// opening CSS Address
var page=require('webpage').create();
var url='http://www.xxx.com/xxx.css'
page.open(url,function(){
if(status!=='success'){
Console.1og ('css access successful!');
}
else{
console.1og ('css access failed!');
}
}};
that is, when a certain CSS is accessed, whether the CSS access is successful is monitored, and if the access is successful, a monitoring result such as "CSS access successful" is output; and if the access fails, outputting a monitoring result such as 'CSS access failure'.
In some embodiments, as shown in fig. 3, step S102 may be followed by step S104 and step S105.
S104, after the target webpage is normally opened, logging in a monitoring account through the headless browser; the monitoring account is a virtual account simulating a real user account.
The monitoring data is data obtained by transforming the actual data of the user within a certain range, can reflect the actual data of the user, achieves the purpose of monitoring the actual data of the user, and simultaneously protects the actual data of the user from being leaked.
Since data of some areas on the web page are very critical, monitoring of the data of these critical areas can be realized through the PhantomJS browser.
Illustratively, a real user account a is used as a template, and a corresponding monitoring account a' simulating the real user account a is configured. The monitoring data corresponding to the monitoring account a' is completely based on the actual data corresponding to the real user account a, and a random transformation is performed on the actual data of the user, for example, the actual data of the user is randomly added or subtracted by a value in a certain range, so as to obtain corresponding monitoring data. Therefore, the monitoring data of the monitoring account A' can ensure the authenticity and effectively protect the actual data of the user.
For example, as shown in fig. 4, an account management system setting interface is provided, where the account management system setting interface includes an account addition "+" control. And when the user clicks the "+" control, displaying new account setting items including but not limited to account name setting items, account password setting items and the like. The user can input the account name, the account password and the like of the corresponding monitoring account based on the account name setting item, the account password setting item and the like. For example, the "geo" is input in the account name setting item, the account name of the monitoring account is set to be "geo", the "pageon" is input in the account password setting item, and the account password of the monitoring account is set to be "pageon".
And when actual data corresponding to the real user account is to be monitored, logging in the monitoring account corresponding to the real user account through the headless browser. For example, an account name and an account password corresponding to the monitoring account are assigned in a user name and password text box through a PhantomJS browser, and a click () event is used for simulating that a user clicks a login button to perform a monitoring account login operation.
S105, after the monitoring account is successfully logged in, monitoring data corresponding to the monitoring account, and determining whether actual data corresponding to the real user account is abnormal or not based on the monitoring data; and the monitoring data is virtual data simulating the actual data.
And after the monitoring account successfully logs in, monitoring the monitoring data corresponding to the monitoring account, wherein the monitoring data can reflect whether the actual data of the user is abnormal or not.
Illustratively, a database trigger is set, and when actual data corresponding to a real user account changes, the monitoring data corresponding to the monitoring account is synchronously changed and updated.
For example, the following triggers are created in the database:
delimiter
create trigger after_insert a after inserts on a for each row
begin
update a'set xxx=xxx+y where id=1;
end
delimiter;
when the actual data a corresponding to the real user account is changed, the monitoring data a' of the corresponding monitoring account is updated, for example, y is added.
For example, a preset threshold range in which data is normal is predefined, and it should be noted that specific values of the preset threshold range can be flexibly set according to actual situations, and are not limited specifically herein.
And comparing the monitored monitoring data with the preset threshold range, and if the monitoring data is in the preset threshold range, determining that the actual data of the corresponding real user account is normal. Otherwise, if the monitoring data is out of the preset threshold range, determining that the actual data of the corresponding real user account is abnormal.
For example, after determining whether actual data corresponding to the real user account is abnormal based on the monitoring data, a corresponding data monitoring result is output. For example, a monitoring result such as "actual data a corresponding to the real user account a is normal/abnormal" is output.
In some embodiments, step S106 may be included after step S103, as shown in fig. 5.
S106, when at least one of the loading condition of the front-end webpage resources and the data output condition of the back-end webpage corresponding to the target webpage is monitored to be abnormal, outputting corresponding alarm information, and/or performing webpage screenshot on the target webpage through the headless browser, and storing a webpage picture obtained through screenshot.
For example, when it is monitored that the page loading time corresponding to the target webpage is abnormal, alarm information of the corresponding page loading time abnormality is output. And performing webpage screenshot on the target webpage through the PhantomJS browser to obtain a webpage picture corresponding to the target webpage and storing the webpage picture.
The current target webpage can be quickly confirmed through the webpage picture, and then the alarm information and/or the webpage picture can be sent to professionals such as front-end research and development and business, so that the professionals are assisted to quickly and definitely locate abnormal conditions.
For another example, when monitoring that the key data corresponding to the target webpage is abnormal, outputting alarm information of the corresponding key data abnormality. And performing webpage screenshot on the target webpage through the PhantomJS browser to obtain a webpage picture corresponding to the target webpage and storing the webpage picture.
The current target webpage can be quickly confirmed through the webpage picture, and then the alarm information and/or the webpage picture can be sent to professionals such as front-end research and development personnel, business personnel and database administrators, so that the professionals are assisted to quickly and definitely locate abnormal conditions.
Illustratively, when the target webpage is not monitored to be abnormal, that is, under the condition that the target webpage is normal, the webpage screenshot of the target webpage can be performed through the headless browser, and the webpage picture obtained by the screenshot is stored.
Illustratively, the storage address corresponding to the webpage picture is configured in advance, including but not limited to a storage file path and a name. And according to the storage address, storing the webpage picture obtained by screenshot in the storage address.
In some embodiments, a mail sending address corresponding to the web page picture is configured in the PhantomJS browser in advance, and the web page picture is sent to the corresponding professional in a mail manner based on the mail sending address.
It should be noted that, besides sending the web page picture to the corresponding professional by email as listed above, the web page picture may also be sent to the corresponding professional by other methods such as WeChat, qq, and the like, and the present application is not limited in particular.
In the above embodiment, the headless browser is invoked to obtain the web page document corresponding to the target web page to be monitored, the target web page is accessed based on the web page document, after the target web page is normally opened, based on at least one pre-configured web page monitoring item (at least one of a web page front end resource loading condition and a web page back end data output condition) corresponding to the headless browser, the at least one web page monitoring item corresponding to the target web page is monitored by the headless browser, the web page front end resource loading condition, the web page back end data output condition and other aspects are monitored, and a user can directly know the web page monitoring condition, that is, the web page is monitored from a user perceivable layer.
Referring to fig. 6, fig. 6 is a schematic block diagram of a web page monitoring apparatus according to an embodiment of the present application, where the web page monitoring apparatus may be configured in a computer device for executing the web page monitoring method.
As shown in fig. 6, the web page monitoring apparatus 1000 includes: a web page access module 1001, and a web page monitoring module 1002.
A web page access module 1001, configured to invoke a headless browser to obtain a web page document corresponding to a target web page to be monitored, and access the target web page based on the web page document;
the web page monitoring module 1002 is configured to determine whether the target web page is normally opened; and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
In one embodiment, the headless browser includes a PhantomJS browser, and the web page access module 1001 is further configured to:
and acquiring the webpage document corresponding to the target webpage through an application program interface of the PhantomJS browser.
In one embodiment, the web page monitoring item includes at least one of a loading status of a front-end resource of the web page, and an output status of a back-end data of the web page, the loading status of the front-end resource of the web page includes a page loading time, and the web page monitoring module 1002 is further configured to:
timing page loading time corresponding to the target webpage through the headless browser;
if the page loading time is less than or equal to a preset time threshold, determining that the page loading time is normal;
and if the page loading time is greater than the preset time threshold, determining that the page loading time is abnormal.
In one embodiment, the web page monitoring module 1002 is further configured to:
when at least one of the loading condition of the webpage front-end resource and the data output condition of the webpage back-end corresponding to the target webpage is monitored to be abnormal, outputting corresponding alarm information, and/or performing webpage screenshot on the target webpage through the headless browser, and storing a webpage picture obtained by screenshot.
In one embodiment, the web page monitoring module 1002 is further configured to:
after the target webpage is normally opened, logging in a monitoring account through the headless browser; the monitoring account is a virtual account simulating a real user account;
after the monitoring account is successfully logged in, monitoring data corresponding to the monitoring account, and determining whether actual data corresponding to the real user account is abnormal or not based on the monitoring data; and the monitoring data is virtual data simulating the actual data.
In one embodiment, the web page monitoring module 1002 is further configured to:
if the monitoring data is within a preset threshold range, determining that the actual data is normal;
and if the monitoring data is out of the preset threshold range, determining that the actual data is abnormal.
In one embodiment, the web page monitoring module 1002 is further configured to:
and outputting a monitoring result for monitoring at least one webpage monitoring item corresponding to the target webpage.
Each module in the web page monitoring device corresponds to each step in the web page monitoring method embodiment, and the functions and implementation processes thereof are not described in detail herein.
The methods, apparatus, and devices of the present application may be deployed in numerous general-purpose or special-purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
For example, the method and apparatus described above may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 7.
Referring to fig. 7, fig. 7 is a schematic block diagram of a computer device according to an embodiment of the present disclosure.
Referring to fig. 7, the computer device includes a processor and a memory connected by a system bus, wherein the memory may include a nonvolatile storage medium and an internal memory.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for running a computer program in the non-volatile storage medium, which when executed by the processor, causes the processor to perform any of the web page monitoring methods.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document;
judging whether the target webpage is normally opened or not;
and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
In an embodiment, the headless browser includes a PhantomJS browser, and the processor is configured to, when the headless browser is called to obtain a web document corresponding to a target web page to be monitored, implement:
and acquiring the webpage document corresponding to the target webpage through an application program interface of the PhantomJS browser.
In an embodiment, the web page monitoring item includes at least one of a web page front end resource loading condition and a web page back end data output condition, the web page front end resource loading condition includes a page loading time, and the processor is configured to implement, when implementing the monitoring of the at least one web page monitoring item corresponding to the target web page by the headless browser, that:
timing page loading time corresponding to the target webpage through the headless browser;
if the page loading time is less than or equal to a preset time threshold, determining that the page loading time is normal;
and if the page loading time is greater than the preset time threshold, determining that the page loading time is abnormal.
In one embodiment, after the monitoring of the at least one web page monitoring item corresponding to the target web page by the headless browser is implemented, the processor is configured to implement:
when at least one of the loading condition of the webpage front-end resource and the data output condition of the webpage back-end corresponding to the target webpage is monitored to be abnormal, outputting corresponding alarm information, and/or performing webpage screenshot on the target webpage through the headless browser, and storing a webpage picture obtained by screenshot.
In one embodiment, after implementing the determining whether the target web page is normally open, the processor is configured to implement:
after the target webpage is normally opened, logging in a monitoring account through the headless browser; the monitoring account is a virtual account simulating a real user account;
after the monitoring account is successfully logged in, monitoring data corresponding to the monitoring account, and determining whether actual data corresponding to the real user account is abnormal or not based on the monitoring data; and the monitoring data is virtual data simulating the actual data.
In one embodiment, the processor, when implementing the determining whether actual data corresponding to the real user account is abnormal based on the monitoring data, is configured to implement:
if the monitoring data is within a preset threshold range, determining that the actual data is normal;
and if the monitoring data is out of the preset threshold range, determining that the actual data is abnormal.
In one embodiment, after the monitoring of the at least one web page monitoring item corresponding to the target web page by the headless browser is implemented, the processor is configured to implement:
and outputting a monitoring result for monitoring at least one webpage monitoring item corresponding to the target webpage.
The embodiment of the application also provides a computer readable storage medium.
The computer readable storage medium of the present application has stored thereon a computer program which, when executed by a processor, implements the steps of the web page monitoring method as described above.
The computer-readable storage medium may be an internal storage unit of the web page monitoring apparatus or the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the web page monitoring apparatus or the computer device. The computer readable storage medium may also be an external storage device of the web page monitoring apparatus or the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital Card (SD Card), a Flash memory Card (Flash Card), and the like, which are equipped on the web page monitoring apparatus or the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention.

Claims (10)

1. A web page monitoring method is characterized by comprising the following steps:
calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document;
judging whether the target webpage is normally opened or not;
and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
2. The method for monitoring web pages according to claim 1, wherein the headless browser includes a PhantomJS browser, and the step of calling the headless browser to obtain the web page document corresponding to the target web page to be monitored includes:
and acquiring the webpage document corresponding to the target webpage through an application program interface of the PhantomJS browser.
3. The method for web page monitoring according to claim 1, wherein the web page monitoring item includes at least one of a web page front end resource loading status and a web page back end data output status, the web page front end resource loading status includes a page loading time, and the monitoring, by the headless browser, of the at least one web page monitoring item corresponding to the target web page includes:
timing page loading time corresponding to the target webpage through the headless browser;
if the page loading time is less than or equal to a preset time threshold, determining that the page loading time is normal;
and if the page loading time is greater than the preset time threshold, determining that the page loading time is abnormal.
4. The method for web page monitoring according to claim 1, wherein after the monitoring of the at least one web page monitoring item corresponding to the target web page by the headless browser, the method comprises:
when at least one of the loading condition of the webpage front-end resource and the data output condition of the webpage back-end corresponding to the target webpage is monitored to be abnormal, outputting corresponding alarm information, and/or performing webpage screenshot on the target webpage through the headless browser, and storing a webpage picture obtained by screenshot.
5. The method for monitoring web pages according to claim 1, wherein after determining whether the target web page is normally opened, the method comprises:
after the target webpage is normally opened, logging in a monitoring account through the headless browser; the monitoring account is a virtual account simulating a real user account;
after the monitoring account is successfully logged in, monitoring data corresponding to the monitoring account, and determining whether actual data corresponding to the real user account is abnormal or not based on the monitoring data; and the monitoring data is virtual data simulating the actual data.
6. The web page monitoring method according to claim 5, wherein the determining whether actual data corresponding to the real user account is abnormal based on the monitoring data comprises:
if the monitoring data is within a preset threshold range, determining that the actual data is normal;
and if the monitoring data is out of the preset threshold range, determining that the actual data is abnormal.
7. The method for web page monitoring according to any one of claims 1 to 6, wherein after the monitoring of at least one web page monitoring item corresponding to the target web page by the headless browser, the method comprises:
and outputting a monitoring result for monitoring at least one webpage monitoring item corresponding to the target webpage.
8. A web page monitoring apparatus, comprising:
the webpage access module is used for calling a headless browser to obtain a webpage document corresponding to a target webpage to be monitored, and accessing the target webpage based on the webpage document;
the webpage monitoring module is used for judging whether the target webpage is normally opened; and after the target webpage is normally opened, monitoring at least one webpage monitoring item corresponding to the target webpage through the headless browser based on at least one preconfigured webpage monitoring item corresponding to the headless browser.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory for storing a computer program;
the processor, configured to execute the computer program and to implement the web page monitoring method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when being executed by a processor, carries out the steps of the web page monitoring method according to any one of claims 1 to 7.
CN202111520756.5A 2021-12-13 2021-12-13 Webpage monitoring method, device, equipment and storage medium Pending CN114185742A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111520756.5A CN114185742A (en) 2021-12-13 2021-12-13 Webpage monitoring method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111520756.5A CN114185742A (en) 2021-12-13 2021-12-13 Webpage monitoring method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114185742A true CN114185742A (en) 2022-03-15

Family

ID=80543544

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111520756.5A Pending CN114185742A (en) 2021-12-13 2021-12-13 Webpage monitoring method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114185742A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117688262A (en) * 2024-02-02 2024-03-12 荣耀终端有限公司 Data processing method, device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117688262A (en) * 2024-02-02 2024-03-12 荣耀终端有限公司 Data processing method, device and storage medium

Similar Documents

Publication Publication Date Title
CN108304498B (en) Webpage data acquisition method and device, computer equipment and storage medium
US8195931B1 (en) Application change control
US8898796B2 (en) Managing network data
US8365188B2 (en) Content management
US7441195B2 (en) Associating website clicks with links on a web page
EP1894081B1 (en) Web usage overlays for third-party web plug-in content
US8539585B2 (en) Systematic approach to uncover visual ambiguity vulnerabilities
CN113238850B (en) RPA realization method, device, equipment and medium based on browser
US11093319B2 (en) Automated recovery of webpage functionality
US8660833B2 (en) Method, computer program product and apparatus for providing an interactive network simulator
WO2004079551A2 (en) Associating website clicks with links on a web page
US20150242470A1 (en) Systems and methods for recommending software applications
US6862620B2 (en) Web page monitoring system and methods therefor
US10291492B2 (en) Systems and methods for discovering sources of online content
CN111431767A (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
CN114185742A (en) Webpage monitoring method, device, equipment and storage medium
CN111859231A (en) Webpage monitoring method, equipment, device and computer storage medium
US20220100636A1 (en) Assisted detection of application performance issues using serverless compute templates
US9104573B1 (en) Providing relevant diagnostic information using ontology rules
CN112613275A (en) Receipt generation method and device, computer equipment and storage medium
CN112130944A (en) Page abnormity detection method, device, equipment and storage medium
US20130024505A1 (en) System, method and computer program product for reconstructing data received by a computer in a manner that is independent of the computer
CN112528189B (en) Data-based component packaging method and device, computer equipment and storage medium
CN111368231B (en) Method and device for testing heterogeneous redundancy architecture website
CN106202319B (en) Abnormal URL (Uniform resource locator) verification method and system

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