Page white screen detection method and device, electronic equipment and storage medium
By monitoring the white screen and detecting the loading and rendering of the engine and components of the WEEX page, and calculating the proportion of white pixels, the accuracy problem of white screen detection on WEEX pages has been solved, and the user experience has been improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN LEXIN SOFTWARE TECH CO LTD
- Filing Date
- 2026-05-19
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technology cannot accurately detect the white screen problem on WEEX pages, resulting in a decline in user experience.
The white screen monitoring task detects the page engine and component loading and rendering, calculates the proportion of white pixels in the component bitmap, determines whether it is a white screen component, and generates alarm notifications when necessary.
It enables fast and accurate detection of blank screens on WEEX pages, reduces false positives and system overhead, and improves user experience.
Smart Images

Figure CN122489192A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data detection and data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting blank screens on web pages. Background Technology
[0002] With the rapid development of mobile internet technology, the forms and types of applications are becoming increasingly diverse. WEEX, as a framework for developing high-performance native applications using modern web technologies, can generate rich and varied application pages. However, for complex WEEX pages, monitoring for blank screens is crucial. Front-end developers often fail to accurately detect missing page content, rendering failures of key nodes, or app component loading failures that lead to blank screens. This means that even when blank screen issues occur, the application cannot promptly detect and address them, impacting user experience. Summary of the Invention
[0003] In view of the above, it is necessary to provide a method for detecting blank screens on application pages, so as to detect and notify when blank screens appear on application pages.
[0004] To achieve the above objectives, the present invention provides a method for detecting blank screen on a webpage, the method comprising: In response to the user's command to open the application page, the page container of the application page is initialized and the page engine is loaded, and it is determined whether the page engine is loaded successfully. When the page engine loads successfully, the page container is rendered by the page engine and a white screen monitoring task is started. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. When it is determined that there are valid page components in the page container, the valid page components are traversed and the proportion of white pixels in the component bitmap corresponding to each valid page component is calculated. Based on the proportion of white pixels, it is determined whether the corresponding valid page component is a white screen component. Based on the determination results of whether each valid page component is a white screen component, the number of white screen components in all valid page components of the page container is counted. When the number of white screen components is greater than or equal to a preset number threshold, it is determined that the application page has a white screen. When the number of white screen components is less than a preset threshold, it is determined whether the number of white screen detections of the white screen monitoring task is greater than a preset value. If so, the white screen monitoring task for the application page is terminated; otherwise, the white screen monitoring task is restarted after a preset time interval to perform white screen detection on the application page.
[0005] Optionally, the step of determining whether a valid page component exists in the page container by traversing the page container through the white screen monitoring task includes: The white screen monitoring task traverses the page container to obtain the page tags corresponding to the page components of each node in the page container; The component attributes contained in the page tag are detected, the width and height values corresponding to the page component in the component attributes are obtained, and the page component is determined as a valid page component based on the obtained results.
[0006] Optionally, determining whether the page component is a valid page component based on the acquisition result includes: When the width and height values of the page component both meet the preset conditions, the page component is determined to be a valid page component. When the width or height value corresponding to the page component does not meet the preset conditions, or when the width or height value corresponding to the page component is not obtained, the page component is determined to be an invalid page component.
[0007] Optionally, the step of traversing the valid page components and calculating the proportion of white pixels in the component bitmap corresponding to each valid page component includes: Iterate through the valid page components and obtain the component bitmap for each valid page component; Detect the width and height of the component bitmap, and calculate the total number of pixels of the component bitmap based on the width and height of the component bitmap; The component bitmap is subjected to grid sampling based on the total number of pixels, and the proportion of white pixels in the component bitmap is calculated based on the sampling results of the grid sampling.
[0008] Optionally, the step of performing grid sampling on the component bitmap based on the total number of pixels, and calculating the proportion of white pixels in the component bitmap based on the sampling results of the grid sampling, includes: The number of sampling points is calculated based on the total number of pixels, and the sampling grid size is calculated based on the number of sampling points. The component bitmap is meshed based on the sampling grid size, and the meshed component bitmap is traversed and sampled to obtain the pixels of each grid of the component bitmap; The pixel color of each grid in the component bitmap is obtained by color recognition of the pixels in each grid, and the proportion of white pixels in the component bitmap is calculated based on the pixel colors of all grids in the component bitmap.
[0009] Optionally, determining whether a corresponding valid page component is a white screen component based on the proportion of white pixels includes: If the proportion of white pixels is greater than or equal to a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a white screen component; If the proportion of white pixels is less than a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a non-white screen component.
[0010] Optionally, after counting the number of white screen components among all valid page components of the page container based on the determination result of whether each valid page component is a white screen component, the method further includes: Calculate the total area of all white screen components in the page container; When the number of white screen components among all valid page components of the page container is greater than or equal to the preset threshold, and the total area of the white screen components is less than the preset area threshold, it is determined that the application page corresponding to the page container has a partial white screen.
[0011] Furthermore, to achieve the above objectives, the present invention also provides a page blank screen detection device, comprising: The page initialization module is used to respond to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine has been loaded successfully. The component detection module is used to render the page container and start the white screen monitoring task when the page engine loads successfully. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. The pixel detection module is used to, when it is determined that there are valid page components in the page container, traverse the valid page components and calculate the proportion of white pixels in the component bitmap corresponding to each valid page component, determine whether the corresponding valid page component is a white screen component based on the proportion of white pixels, count the number of white screen components among all valid page components in the page container based on the determination results of whether each valid page component is a white screen component, and determine that the application page has a white screen when the number of white screen components is greater than or equal to a preset number threshold. The duplicate detection module is used to determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value when the number of white screen components is less than a preset threshold. If so, the white screen monitoring task for the application page is terminated; otherwise, the white screen monitoring task is restarted to perform white screen detection on the application page after a preset time interval.
[0012] Furthermore, to achieve the above objectives, the present invention also provides an electronic device, the electronic device comprising: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the page blank screen detection method described above.
[0013] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the page blank screen detection method described above.
[0014] This invention detects white screen phenomena in application pages that may occur due to failures in page engine loading, page component loading and rendering, and issues alarm notifications. By traversing page containers and page components, it uses a grid combined with random sampling to detect the proportion of white pixels, thereby reducing false positives and system consumption, and achieving rapid detection of white screens. Attached Figure Description
[0015] Figure 1 This is a flowchart of an embodiment of the page blank screen detection method of the present invention; Figure 2 This is a schematic diagram of an embodiment of the electronic device of the present invention; Figure 3 This is a schematic diagram of an embodiment of the page blank screen detection device of the present invention.
[0016] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0018] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0019] like Figure 1 The flowchart shown is a representation of an embodiment of the page blank screen detection method of the present invention, including steps S1-S4.
[0020] S1. In response to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine has been loaded successfully.
[0021] In one embodiment, the application's page can be a Weex page. When the application needs to open a Weex page, it loads and renders the page components by initializing the Weex page container and loading the corresponding page engine. The page container includes a root node container that loads the entire page and child node containers that load each page component in the page. After loading, the page engine renders each node of the page container.
[0022] In one embodiment, when the page engine fails to load, the page engine is reloaded, or a notification is generated based on the page engine's loading data so that users of the terminal and application can perform corresponding application page operations (such as refreshing the page, reloading the page, etc.) according to the notification.
[0023] S2. When the page engine loads successfully, the page container is rendered by the page engine and a white screen monitoring task is started. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen.
[0024] In one embodiment, page rendering is performed using a page engine. After page rendering is complete, a white screen monitoring task is initiated after a preset delay time. The white screen monitoring task detects whether page components have been successfully loaded or rendered. When none of the page components in the page container have been successfully loaded or rendered, it is determined that the page container does not contain any valid page components, the corresponding application page displays a complete white screen, and a corresponding white screen alarm notification is generated.
[0025] In one embodiment, determining whether a valid page component exists in the page container by traversing the page container through the white screen monitoring task includes: The white screen monitoring task traverses the page container to obtain the page tags corresponding to the page components of each node in the page container; The component attributes contained in the page tag are detected, the width and height values corresponding to the page component in the component attributes are obtained, and the page component is determined as a valid page component based on the obtained results.
[0026] For example, if the application page is an HTML page, the page tags corresponding to the page components of each node in the page container are div tags, and the component attributes contained in the page tags are the CSS style attributes contained in the div tags.
[0027] In one embodiment, determining whether the page component is a valid page component based on the acquisition result includes: When the width and height values of the page component both meet the preset conditions, the page component is determined to be a valid page component. When the width or height value corresponding to the page component does not meet the preset conditions, or when the width or height value corresponding to the page component is not obtained, the page component is determined to be an invalid page component.
[0028] In this embodiment, the preset condition is that the width or height value is greater than 0. When either the width or height value corresponding to the page component is not greater than 0, or when the page component does not have a corresponding width or height value set, the page component cannot be effectively displayed on the application page, and in this case, the page component is considered an invalid page component.
[0029] In one embodiment, after determining that the application page has a blank screen, the application generates a blank screen alarm notification and displays the blank screen alarm notification on the terminal so that the user of the terminal and the application can perform corresponding application page operations (such as refreshing the page, reloading the page, etc.) according to the alarm notification.
[0030] In this embodiment, the white screen monitoring task detects whether the successfully rendered components of the page are white screen components by traversing the page container and the valid page components of the page container, and generates corresponding notifications to issue alarms by determining whether the page is completely white or partially white.
[0031] S3. When it is determined that there are valid page components in the page container, the valid page components are traversed and the proportion of white pixels in the component bitmap corresponding to each valid page component is calculated. Based on the proportion of white pixels, it is determined whether the corresponding valid page component is a white screen component. Based on the determination results of whether each valid page component is a white screen component, the number of white screen components in all valid page components of the page container is counted. When the number of white screen components is greater than or equal to a preset number threshold, it is determined that the application page has a white screen.
[0032] In one embodiment, the step of traversing the valid page components and calculating the percentage of white pixels in the component bitmap corresponding to each valid page component includes: Iterate through the valid page components and obtain the component bitmap for each valid page component; Detect the width and height of the component bitmap, and calculate the total number of pixels of the component bitmap based on the width and height of the component bitmap; The component bitmap is subjected to grid sampling based on the total number of pixels, and the proportion of white pixels in the component bitmap is calculated based on the sampling results of the grid sampling.
[0033] For example: Pre-set the correspondence between the total number of pixels and the sampling rate, and set the minimum and maximum values for the number of sampling points. When the total number of pixels in the component bitmap is greater than 500,000, the sampling rate is 10%; when the total number of pixels is less than or equal to 500,000, the sampling rate is 20%; and when the total number of pixels is less than or equal to 100,000, the sampling rate is 50%. Calculate the total number of pixels × sampling rate to get the number of sampling points. If the number of sampling points is less than the minimum value, change it to the minimum value of 1000; if the number of sampling points is greater than the maximum value, change it to the maximum value of 100,000. Divide the number of sampling points by the preset number of random samples per grid to get the number of grids. Calculate the grid size based on the number of grids and the size of the component bitmap, and then mesh the component bitmap based on the grid size.
[0034] In this embodiment, dense sampling (50%) is performed on small images (≤100,000 pixels) to avoid misjudgment, and minimum and maximum values of the number of sampling points are set to avoid the statistical results being distorted due to too small or too large a number of samples.
[0035] In one embodiment, the step of performing grid sampling on the component bitmap based on the total number of pixels, and calculating the proportion of white pixels in the component bitmap based on the sampling results of the grid sampling, includes: The number of sampling points is calculated based on the total number of pixels, and the sampling grid size is calculated based on the number of sampling points. The component bitmap is meshed based on the sampling grid size, and the meshed component bitmap is traversed and sampled to obtain the pixels of each grid of the component bitmap; The pixel color of each grid in the component bitmap is obtained by color recognition of the pixels in each grid, and the proportion of white pixels in the component bitmap is calculated based on the pixel colors of all grids in the component bitmap.
[0036] For example: Traverse the gridded component bitmap from left to right and from top to bottom (horizontal grid traversal and vertical grid traversal), randomly sample a preset number of pixels in each grid, calculate the coordinates of the sampled pixels in the component bitmap, determine whether the sampled pixels have out-of-bounds anomalies based on the coordinate range of the sampled pixels and the corresponding grid coordinates, if so, resample, read the color of the sampled pixels and determine whether the color of each sampled pixel is white or near white, count the colors of all sampled pixels in each grid to determine the proportion of white pixels in the component bitmap.
[0037] In this embodiment, a grid combined with random point sampling ensures that the sampling points of the component bitmap are evenly distributed, reducing the error in judging the component white screen.
[0038] In one embodiment, determining whether a corresponding valid page component is a white screen component based on the proportion of white pixels includes: If the proportion of white pixels is greater than or equal to a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a white screen component; If the proportion of white pixels is less than a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a non-white screen component.
[0039] For example, if the percentage of white pixels in a page component is greater than or equal to 65% of the total number of pixels, the page component is considered a white screen component.
[0040] In one embodiment, after counting the number of white screen components among all valid page components of the page container based on the determination result of whether each valid page component is a white screen component, the method further includes: Calculate the total area of all white screen components in the page container; When the number of white screen components among all valid page components of the page container is greater than or equal to the preset threshold, and the total area of the white screen components is less than the preset area threshold, it is determined that the application page corresponding to the page container has a partial white screen.
[0041] Specifically, the preset area threshold can be set based on the total area of the application page.
[0042] In one embodiment, the preset threshold may be half of the total number of valid page components in the page container. When the number of white screen components is greater than or equal to the preset threshold, it is determined that the application page has a white screen, including: when the number of valid page components in the page container that are determined to be white screen components is greater than or equal to half of the total number of valid page components in the page container, it is determined that the application page corresponding to the page container has a white screen.
[0043] In one embodiment, when it is determined that the application page has a blank screen, a corresponding blank screen alarm notification is generated based on the blank screen detection data (such as a complete blank screen without valid page components or a partial blank screen with blank screen components), and the blank screen alarm notification is displayed on the terminal so that users of the terminal and the application can perform corresponding application page operations (such as refreshing the page, reloading the page, etc.) based on the alarm notification.
[0044] In this embodiment, by calculating the proportion of white pixels in each page component and judging the white screen, the specific white screen component can be located more precisely, thereby quickly responding to and troubleshooting the white screen problem and effectively distinguishing between a complete white screen and a partial white screen.
[0045] S4. When the number of white screen components is less than a preset threshold, determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value. If so, end the white screen monitoring task for the application page. Otherwise, restart the white screen monitoring task to perform white screen detection on the application page after a preset time interval.
[0046] In one embodiment, the white screen detection count of the white screen monitoring task is the number of times the white screen monitoring task detects that the application page does not have a white screen.
[0047] In this embodiment, when the number of white screen detections by the white screen monitoring task exceeds a preset value, it is determined that the application page has not shown a white screen after multiple checks, and the white screen monitoring task can be terminated directly to reduce resource consumption. When the number of white screen detections by the white screen monitoring task is less than or equal to the preset value, to avoid false positives and false negatives, the white screen monitoring task needs to be restarted periodically to perform white screen checks on the application page until the number of white screen detections within a monitoring cycle exceeds the preset value, and it is determined that the application page has passed multiple white screen checks normally, at which point the white screen monitoring task is terminated.
[0048] As can be seen from the above embodiments, the page white screen detection method proposed in this invention detects the phenomenon that may cause the application page to appear white screen by failing to load the page engine and load and render page components in the application page through the white screen monitoring task, and issues an alarm notification. By traversing the page container and page components, the method uses a grid combined with random sampling to detect the proportion of white pixels, thereby reducing false judgments and system consumption, and achieving rapid detection of white screen.
[0049] like Figure 2 The diagram shown is a schematic representation of an embodiment of the electronic device of the present invention. The electronic device 1 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. The electronic device 1 can be a computer, mobile phone, or other user-accessible electronic terminal.
[0050] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected via a system bus. The memory 11 stores a page white screen detection program 10, which can be executed by the processor 12. Figure 3 Only the electronic device 1 with components 11-13 and the page blank detection program 10 is shown. Those skilled in the art will understand that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0051] The memory 11 includes RAM and at least one type of readable storage medium. The RAM provides a cache for the operation of the electronic device 1; the readable storage medium can be volatile or non-volatile. Specifically, the readable storage medium can be a storage medium such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1; in other embodiments, the storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 1. In this embodiment, the readable storage medium of the memory 11 mainly includes a program storage area and a data storage area. The program storage area is typically used to store the operating system and various application software installed on the electronic device 1, such as the code of the page white screen detection program 10 in one embodiment of the present invention. The data storage area can store data created based on the use of blockchain nodes, such as various types of data that have been output or will be output.
[0052] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. This processor 12 is typically used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to run program code stored in the memory 11 or process data, such as running a white screen detection program 10.
[0053] The network interface 13 may include a wireless network interface or a wired network interface, which is used to establish a communication connection between the electronic device 1 and the server (not shown in the figure).
[0054] Optionally, the electronic device 1 may further include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0055] In one embodiment of the present invention, when the page blank screen detection program 10 is executed by the processor 12, the following steps S1-S4 are implemented.
[0056] S1. Responding to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine is loaded successfully. S2. When the page engine is successfully loaded, the page container is rendered by the page engine and a white screen monitoring task is started. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. S3. When it is determined that there are valid page components in the page container, the valid page components are traversed and the proportion of white pixels in the component bitmap corresponding to each valid page component is calculated. Based on the proportion of white pixels, it is determined whether the corresponding valid page component is a white screen component. Based on the determination results of whether each valid page component is a white screen component, the number of white screen components in all valid page components of the page container is counted. When the number of white screen components is greater than or equal to a preset number threshold, it is determined that the application page has a white screen. S4. When the number of white screen components is less than a preset threshold, determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value. If so, end the white screen monitoring task for the application page. Otherwise, restart the white screen monitoring task to perform white screen detection on the application page after a preset time interval.
[0057] The specific operation steps implemented by the above steps S1-S4 are largely the same as those in an embodiment of the page white screen detection method of the present invention, and will not be repeated here.
[0058] In other embodiments, the page blank screen detection program 10 may be divided into one or more modules, which are stored in the memory 11 and executed by one or more processors (processor 12 in this embodiment) to complete the present invention. The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions and are used to describe the execution process of the page blank screen detection program 10 in the electronic device 1.
[0059] like Figure 3 The diagram shown is a schematic representation of an embodiment of the page blank screen detection device of the present invention.
[0060] In a first embodiment of the present invention, the page blank screen detection device 100 includes a page initialization module 110, a component detection module 120, a pixel detection module 130, and a repetition detection module 140, as exemplarily: The page initialization module 110 is used to respond to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine is loaded successfully. The component detection module 120 is used to render the page container and start a white screen monitoring task through the page engine when the page engine is successfully loaded. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. The pixel detection module 130 is used to, when it is determined that there are valid page components in the page container, traverse the valid page components and calculate the proportion of white pixels in the component bitmap corresponding to each valid page component, determine whether the corresponding valid page component is a white screen component based on the proportion of white pixels, count the number of white screen components among all valid page components in the page container based on the determination results of whether each valid page component is a white screen component, and determine that the application page has a white screen when the number of white screen components is greater than or equal to a preset number threshold. The duplicate detection module 140 is used to determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value when the number of white screen components is less than a preset threshold. If so, the white screen monitoring task for the application page is terminated; otherwise, the white screen monitoring task is restarted to perform white screen detection on the application page after a preset time interval.
[0061] The specific operation steps implemented by the page initialization module 110, component detection module 120, pixel detection module 130 and duplicate detection module 140 when they are executed are largely the same as those in the above embodiments, and will not be repeated here.
[0062] Furthermore, this embodiment of the invention also proposes a computer-readable storage medium, which can be volatile or non-volatile. Specifically, the computer-readable storage medium can be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable storage medium stores a page white screen detection program 10.
[0063] When the page blank screen detection program 10 is executed by the processor, it performs the following operations: A1. Responding to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine is loaded successfully; A2. When the page engine loads successfully, the page container is rendered by the page engine and a white screen monitoring task is started. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. A3. When it is determined that there are valid page components in the page container, the valid page components are traversed and the proportion of white pixels in the component bitmap corresponding to each valid page component is calculated. Based on the proportion of white pixels, it is determined whether the corresponding valid page component is a white screen component. Based on the determination results of whether each valid page component is a white screen component, the number of white screen components in all valid page components of the page container is counted. When the number of white screen components is greater than or equal to a preset number threshold, it is determined that the application page has a white screen. A4. When the number of white screen components is less than a preset threshold, determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value. If so, end the white screen monitoring task for the application page. Otherwise, restart the white screen monitoring task to perform white screen detection on the application page after a preset time interval.
[0064] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0065] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0066] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0067] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for detecting blank screens on a computer screen, applied to a terminal with an application installed, characterized in that, The method includes: In response to the user's command to open the application page, the page container of the application page is initialized and the page engine is loaded, and it is determined whether the page engine is loaded successfully. When the page engine loads successfully, the page container is rendered by the page engine and a white screen monitoring task is started. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. When it is determined that there are valid page components in the page container, the valid page components are traversed and the proportion of white pixels in the component bitmap corresponding to each valid page component is calculated. Based on the proportion of white pixels, it is determined whether the corresponding valid page component is a white screen component. Based on the determination results of whether each valid page component is a white screen component, the number of white screen components in all valid page components of the page container is counted. When the number of white screen components is greater than or equal to a preset number threshold, it is determined that the application page has a white screen. When the number of white screen components is less than a preset threshold, it is determined whether the number of white screen detections of the white screen monitoring task is greater than a preset value. If so, the white screen monitoring task for the application page is terminated; otherwise, the white screen monitoring task is restarted after a preset time interval to perform white screen detection on the application page.
2. The page blank screen detection method as described in claim 1, characterized in that, The step of determining whether a valid page component exists in the page container by traversing the page container through the white screen monitoring task includes: The white screen monitoring task traverses the page container to obtain the page tags corresponding to the page components of each node in the page container; The component attributes contained in the page tag are detected, the width and height values corresponding to the page component in the component attributes are obtained, and the page component is determined as a valid page component based on the obtained results.
3. The page blank screen detection method as described in claim 2, characterized in that, The step of determining whether the page component is a valid page component based on the obtained result includes: When the width and height values of the page component both meet the preset conditions, the page component is determined to be a valid page component. When the width or height value corresponding to the page component does not meet the preset conditions, or when the width or height value corresponding to the page component is not obtained, the page component is determined to be an invalid page component.
4. The page blank screen detection method as described in claim 1, characterized in that, The step of traversing the valid page components and calculating the percentage of white pixels in the component bitmap corresponding to each valid page component includes: Iterate through the valid page components and obtain the component bitmap for each valid page component; Detect the width and height of the component bitmap, and calculate the total number of pixels of the component bitmap based on the width and height of the component bitmap; The component bitmap is subjected to grid sampling based on the total number of pixels, and the proportion of white pixels in the component bitmap is calculated based on the sampling results of the grid sampling.
5. The page blank screen detection method as described in claim 4, characterized in that, The step of performing grid sampling on the component bitmap based on the total number of pixels, and calculating the proportion of white pixels in the component bitmap based on the sampling results of the grid sampling, includes: The number of sampling points is calculated based on the total number of pixels, and the sampling grid size is calculated based on the number of sampling points. The component bitmap is meshed based on the sampling grid size, and the meshed component bitmap is traversed and sampled to obtain the pixels of each grid of the component bitmap; The pixel color of each grid in the component bitmap is obtained by color recognition of the pixels in each grid, and the proportion of white pixels in the component bitmap is calculated based on the pixel colors of all grids in the component bitmap.
6. The page blank screen detection method as described in claim 1, characterized in that, The step of determining whether a corresponding valid page component is a white screen component based on the proportion of white pixels includes: If the proportion of white pixels is greater than or equal to a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a white screen component; If the proportion of white pixels is less than a preset threshold, then the component corresponding to the proportion of white pixels is determined to be a non-white screen component.
7. The page blank screen detection method as described in claim 1, characterized in that, After counting the number of blank screen components among all valid page components of the page container based on the determination results of whether each valid page component is a blank screen component, the process also includes: Calculate the total area of all white screen components in the page container; When the number of white screen components among all valid page components of the page container is greater than or equal to the preset threshold, and the total area of the white screen components is less than the preset area threshold, it is determined that the application page corresponding to the page container has a partial white screen.
8. A device for detecting blank screen on a webpage, characterized in that, include: The page initialization module is used to respond to the user's operation command to open the application page, initialize the page container of the application page and load the page engine, and determine whether the page engine has been loaded successfully. The component detection module is used to render the page container and start the white screen monitoring task when the page engine loads successfully. The white screen monitoring task traverses the page container to determine whether there are valid page components in the page container. If there are no valid page components in the page container, it is determined that the application page has a white screen. The pixel detection module is used to, when it is determined that there are valid page components in the page container, traverse the valid page components and calculate the proportion of white pixels in the component bitmap corresponding to each valid page component, determine whether the corresponding valid page component is a white screen component based on the proportion of white pixels, count the number of white screen components among all valid page components in the page container based on the determination results of whether each valid page component is a white screen component, and determine that the application page has a white screen when the number of white screen components is greater than or equal to a preset number threshold. The duplicate detection module is used to determine whether the number of white screen detections of the white screen monitoring task is greater than a preset value when the number of white screen components is less than a preset threshold. If so, the white screen monitoring task for the application page is terminated; otherwise, the white screen monitoring task is restarted to perform white screen detection on the application page after a preset time interval.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, the instructions of which are executed by the at least one processor to enable the at least one processor to perform the page blank detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the page white screen detection method as described in any one of claims 1 to 7.