A web page testing method, device and equipment
The method automates web page testing by determining and triggering areas to be tested, detecting abnormalities, and adjusting the process based on conditions, enhancing efficiency and coverage in web page testing.
Patent Information
- Application Number
- CN202110731294.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-29
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-06-29
AI Technical Summary
Existing web page testing methods rely on manual clicking, which is inefficient and difficult to perform large-scale testing effectively.
A method and device for automatic web page testing that involves determining areas to be tested through screenshots, triggering them in sequence, detecting abnormalities after page jumps, and adjusting the process based on preset conditions to ensure comprehensive testing.
This approach enhances testing efficiency by enabling automatic, multi-level testing of web pages, improving the coverage and speed of web page testing processes.
Smart Images

Figure CN113342684B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing, and in particular to a method, device and equipment for testing a web page. Background Art
[0002] Web pages include areas that can be clicked to trigger page redirection. Users can click on clickable areas in web pages to redirect to different web pages and browse the content of different web pages. When testing web pages, it is necessary to test the redirection of web pages. Based on the test results, web pages with redirection problems can be adjusted to improve the user experience of web pages.
[0003] At present, the web page jump is usually triggered by manually clicking on the web page to implement the test of the web page jump. The test method of manual clicking is inefficient. How to implement efficient testing of web page jump is a problem that needs to be solved. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a method, device and equipment for testing a web page, which can realize automatic testing of a web page and improve the testing efficiency of the web page testing.
[0005] Based on this, the technical solutions provided by the embodiments of the present application are as follows:
[0006] A method for testing a web page, the method comprising:
[0007] Get a screenshot of the current web page;
[0008] Determine at least one area to be tested in the current web page according to the page screenshot;
[0009] According to the trigger record, triggering the areas to be tested in the current web page in sequence according to the trigger order, and updating the trigger record;
[0010] If the tested area is triggered and the page jumps to the next level, the page after the jump is re-determined as the current page, the abnormality of the current page is detected, and the abnormality detection result corresponding to the tested area in the previous level page of the current page is obtained;
[0011] When the preset condition is not met, re-execute the steps of obtaining a screenshot of the current web page and subsequent steps;
[0012] When the preset condition is met, jump back to the previous level web page from the current web page, re-determine the web page after the jump as the current web page, and judge again whether the preset condition is met. If not, continue to execute the trigger record, trigger the test area and subsequent steps in the current web page in sequence according to the trigger order.
[0013] In a possible implementation manner, the preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
[0014] In a possible implementation, determining at least one area to be tested in the current webpage according to the page screenshot includes:
[0015] Determine the webpage type of the current webpage;
[0016] If the webpage type is a search result page, input the page screenshot into a target detection model to obtain a region to be tested in the page screenshot; the target detection model is trained by the first historical page screenshot and a label of the region to be tested in the first historical page screenshot;
[0017] If the webpage type is a non-search result page, converting the page screenshot into a grayscale image, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each connected area as the area to be tested in the page screenshot;
[0018] The area to be tested in the page screenshot is mapped to the current web page to obtain at least one area to be tested in the current web page.
[0019] In a possible implementation manner, determining the webpage type of the current webpage includes:
[0020] Obtaining a webpage source code of the current webpage, and identifying a first target identifier from the webpage source code;
[0021] If a first target identifier is identified from the webpage source code, determining the webpage type of the current webpage as a search result page;
[0022] If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
[0023] In a possible implementation, the method further includes:
[0024] Inputting the page screenshot into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution within the actual clickable area in the second historical page screenshot;
[0025] Adding the thermal values of each pixel in each of the to-be-tested areas to obtain the sum of the thermal values of the to-be-tested area;
[0026] The areas to be tested are sorted according to the sum of the thermal values of the areas to be tested, and a triggering order of the areas to be tested is determined.
[0027] In a possible implementation, detecting an abnormality of the current webpage and obtaining an abnormality detection result corresponding to the to-be-tested area in a webpage one level above the current webpage includes:
[0028] Detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the tested area in the previous level web page of the current web page.
[0029] In a possible implementation, the detecting whether the current webpage has one or more abnormal conditions such as page blanking anomaly, page access anomaly, thumbnail missing anomaly, garbled text anomaly, and pop-up window anomaly includes one or more of the following:
[0030] Detecting whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, determining that the current webpage has a page blanking anomaly;
[0031] Detecting a status identifier of the current webpage, and if the status identifier is a second target identifier, determining that a page access anomaly exists in the current webpage;
[0032] Detecting whether there is a preset target image in the page screenshot of the current webpage, and if there is a preset target image, determining that there is a thumbnail missing exception in the current webpage;
[0033] Acquire the text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text exception;
[0034] The page screenshot of the current webpage is classified and identified to determine whether it includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current webpage has a pop-up window.
[0035] A web page testing device, the device comprising:
[0036] An acquisition unit, used to acquire a screenshot of the current web page;
[0037] A determination unit, configured to determine at least one area to be tested in the current web page according to the page screenshot;
[0038] A trigger unit, configured to trigger the areas to be tested in the current web page in sequence according to the trigger record and the triggering sequence, and update the trigger record;
[0039] A detection unit, for if the to-be-tested area is triggered and the webpage to the next level is jumped, re-determines the webpage after the jump as the current webpage, detects the abnormality of the current webpage, and obtains the abnormality detection result corresponding to the to-be-tested area in the webpage of the previous level of the current webpage;
[0040] A first execution unit, configured to re-execute the steps of obtaining a screenshot of the current web page and subsequent steps when a preset condition is not met;
[0041] The second execution unit is used to jump back to the previous level web page from the current web page when the preset condition is met, redetermine the web page after the jump as the current web page, and again determine whether the preset condition is met. If not, continue to execute the trigger record, trigger the area to be tested in the current web page and subsequent steps in sequence according to the trigger order.
[0042] In a possible implementation manner, the preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
[0043] In a possible implementation manner, the determining unit includes:
[0044] A determination subunit, used to determine the webpage type of the current webpage;
[0045] A first acquisition subunit is used for inputting the page screenshot into a target detection model to obtain a region to be tested in the page screenshot if the webpage type is a search result page; the target detection model is trained by the first historical page screenshot and the label of the region to be tested in the first historical page screenshot;
[0046] The second acquisition subunit is used for converting the page screenshot into a grayscale image if the webpage type is a non-search result page, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, and obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each of the connected areas as the area to be tested in the page screenshot;
[0047] The mapping subunit is used to map the area to be tested in the page screenshot to the current web page to obtain at least one area to be tested in the current web page.
[0048] In a possible implementation, the determining subunit is specifically configured to obtain a webpage source code of the current webpage, and identify a first target identifier from the webpage source code;
[0049] If a first target identifier is identified from the webpage source code, determining the webpage type of the current webpage as a search result page;
[0050] If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
[0051] In a possible implementation manner, the device further includes:
[0052] An input unit, used for inputting the page screenshot into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution in the actual clickable area in the second historical page screenshot;
[0053] A calculation unit, used for adding the thermal values of each pixel in each of the areas to be tested to obtain the sum of the thermal values of the area to be tested;
[0054] A sorting unit is used to sort the areas to be tested according to the sum of the thermal values of the areas to be tested, and determine the triggering order of the areas to be tested.
[0055] In a possible implementation, the detection unit is specifically used to detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the tested area in the previous level web page of the current web page.
[0056] In a possible implementation, the detection unit includes the following detection subunit or multiple detection subunits:
[0057] The first detection subunit is used to detect whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, it is determined that the current webpage has a page blanking anomaly;
[0058] A second detection subunit detects a status identifier of the current webpage, and if the status identifier is a second target identifier, determines that a page access anomaly exists in the current webpage;
[0059] A third detection subunit detects whether there is a preset target image in the page screenshot of the current webpage, and if the preset target image exists, determines that there is a thumbnail missing abnormality in the current webpage;
[0060] A fourth detection subunit is configured to obtain text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text anomaly;
[0061] The fifth detection subunit classifies and identifies whether the page screenshot of the current web page includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current web page has a pop-up window.
[0062] A web page testing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the one or more programs to execute the above-mentioned web page testing method.
[0063] A computer-readable medium stores instructions which, when executed by one or more processors, enable a device to execute the web page testing method.
[0064] It can be seen that the embodiments of the present application have the following beneficial effects:
[0065] The embodiment of the present application provides a method, device and equipment for testing a web page. First, at least one area to be tested in the current web page is determined by obtaining a screenshot of the current web page; then, according to the trigger record, the areas to be tested are triggered in sequence according to the trigger order. After jumping to the next-level web page, the abnormality of the web page after the jump can be detected to obtain the abnormality detection result of the area to be tested, so as to realize automatic testing of the web page; determine whether the preset condition is met; if not, take a screenshot of the current page and continue to test; if met, jump back to the previous-level web page, and continue to trigger the area to be tested when the preset condition is not met, and perform subsequent testing steps. In this way, the areas to be tested in the current web page can be tested in sequence, so as to realize a more comprehensive test of the areas to be tested in the current web page. By automatically determining the area to be tested in the current web page, automatically triggering the area to be tested and performing abnormality detection on the web page after the jump, the jump situation of the current web page can be automatically tested, thereby improving the efficiency of web page testing. In addition, the test of multi-level web pages can be realized, and the test of web pages in a large range can be realized efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A schematic diagram of a framework of an exemplary application scenario provided in an embodiment of the present application;
[0067] Figure 2 A flowchart of a web page testing method provided in an embodiment of the present application;
[0068] Figure 3 A flowchart of a web page testing method provided in an embodiment of the present application;
[0069] Figure 4 A schematic diagram of the structure of a web page testing device provided in an embodiment of the present application;
[0070] Figure 5 A schematic diagram of another web page testing device structure provided in an embodiment of the present application;
[0071] Figure 6 A schematic diagram of a server structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0073] In order to facilitate the understanding and explanation of the technical solutions provided by the embodiments of the present application, the background technology of the present application will be described below.
[0074] After studying traditional web page testing methods, the inventor found that most of the existing testing methods for web page jumps are triggered by manual clicks. The web page jump is triggered by manually clicking on the clickable area in the web page, and then judging whether the web page can jump normally and whether the web page after the jump can be displayed normally, the test result of the web page is obtained. However, the manual click test method is inefficient and it is difficult to quickly complete a large number of web page jump tests.
[0075] Based on this, the embodiment of the present application provides a method, device and equipment for testing a web page. First, at least one area to be tested in the current web page is determined by obtaining a screenshot of the current web page; then, according to the trigger record, the areas to be tested are triggered in sequence according to the trigger order. After jumping to the next-level web page, the abnormal situation of the web page after the jump can be detected to obtain the abnormal detection result of the area to be tested, so as to realize automatic testing of the web page; judge whether the preset condition is met; if not, a screenshot is taken for the current page to continue the test; if it is met, jump back to the previous-level web page, and continue to trigger the area to be tested when the preset condition is not met, and perform subsequent test steps. In this way, the areas to be tested in the current web page can be tested in sequence, so as to realize a more comprehensive test of the areas to be tested in the current web page. By automatically determining the area to be tested in the current web page, automatically triggering the area to be tested and performing abnormal detection on the web page after the jump, the jump situation of the current web page can be automatically tested, which improves the efficiency of web page testing. In addition, it is possible to realize the testing of multi-level web pages, and efficiently realize the testing of web pages in a larger range.
[0076] See also Figure 1 , which is a schematic diagram of a framework of an exemplary application scenario provided by an embodiment of the present application. The web page testing method provided by an embodiment of the present application can be applied to a client 10.
[0077] The web page 101 that needs to be tested and is accessed by the client 10 is taken as the current web page, and a page screenshot of the current web page is obtained. At least one area to be tested in the current web page is determined based on the page screenshot. According to the triggering sequence, the areas to be tested are triggered in the current web page in sequence, and after the triggering, the triggering record is updated. If the current web page jumps to the next-level web page 102 after the area to be tested is triggered, the next-level web page 102 is determined as the current web page, and the abnormal situation of the current web page is detected to obtain the abnormal detection result corresponding to the area to be tested. If the preset condition is met, the current web page, that is, the web page 102, jumps back to the previous-level web page 101, and the web page after the jump is determined as the current web page. Based on the triggering record, the areas to be tested are continuously triggered and subsequently tested according to the triggering sequence until the preset condition is met.
[0078] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0079] It should be noted that the client 10 can be any user device that is currently available, under development, or developed in the future, and can interact with each other through any form of wired and / or wireless connection (e.g., Wi-Fi, LAN, cellular, coaxial cable, etc.), including but not limited to: smart wearable devices, smart phones, non-smart phones, tablet computers, laptop personal computers, desktop personal computers, small computers, mid-size computers, mainframe computers, etc. that are currently available, under development, or developed in the future. The embodiments of the present application are not limited in this regard.
[0080] To facilitate understanding of the technical solution provided in the embodiment of the present application, the method for implementing feature selection provided in the embodiment of the present application will be described below with reference to the accompanying drawings.
[0081] See also Figure 2 , which is a flow chart of a web page testing method provided by an embodiment of the present application, such as Figure 2 As shown, the method may include S201-S206.
[0082] S201: Obtain a screenshot of the current web page.
[0083] The current web page is a web page that needs to be tested. The current web page can be any web page that needs to be tested on the website.
[0084] Taking a screenshot of the current webpage to obtain a page screenshot of the current webpage. In a possible implementation, a screenshot operation may be performed on the screen of a device displaying the current webpage to obtain a page screenshot of the current webpage.
[0085] S202: Determine at least one area to be tested in the current web page according to the page screenshot.
[0086] The page screenshot of the current webpage includes the area displayed on the current webpage. Based on the page screenshot, the current webpage is divided into regions to determine the area to be tested in the current webpage. The area to be tested is the area in the current webpage that needs to be tested by triggering. The current webpage includes at least one area to be tested.
[0087] In a possible implementation, a corresponding method may be adopted to determine the area to be tested in the current webpage according to the webpage type of the current webpage. The present application embodiment provides a specific implementation of S202, that is, determining at least one area to be tested in the current webpage according to the page screenshot, as shown below.
[0088] S203: According to the trigger record, the areas to be tested are triggered in sequence in the current web page according to the trigger sequence, and the trigger record is updated.
[0089] After determining the area to be tested included in the current webpage, trigger the area to be tested according to the trigger record. The trigger record is used to record the trigger progress of the area to be tested. Based on the trigger record, the area to be tested that has been triggered and the area to be tested that has not been triggered can be determined. The trigger record includes information related to the progress of triggering the area to be tested. For example, the trigger record may include relevant information of the area to be tested that has completed the trigger operation. For another example, the trigger record includes relevant information of the area to be tested that has not completed the trigger operation.
[0090] When triggering the test area, it is necessary to trigger the test areas in sequence according to the triggering order. In this way, the test areas can be triggered in order to avoid omissions and achieve a more comprehensive test.
[0091] In a possible implementation, the triggering order may be determined according to the position of the test area in the current web page. For example, the test areas may be triggered in order from top to bottom and from left to right according to their positions in the current web page.
[0092] In another possible implementation, the determined area to be tested may be an area that cannot be triggered to implement a web page jump. For example, the determined area to be tested does not include a link for a web page jump, and a jump to another web page cannot be achieved by triggering. The area to be tested that can be triggered to implement a web page jump can be triggered first to implement a test with higher effectiveness. Based on this, the embodiment of the present application also provides a method for determining a trigger order, which will be described below for details.
[0093] After the area to be tested is triggered, the trigger record is updated so that the next area to be tested can be triggered according to the trigger record.
[0094] S204: If the tested area is triggered and the page jumps to the next level, the page after the jump is re-determined as the current page, the abnormality of the current page is detected, and the abnormality detection result corresponding to the tested area in the previous level page of the current page is obtained.
[0095] For the area to be tested that can trigger a web page jump, after being triggered, it will jump to the next level web page, where the next level web page refers to a web page obtained after a jump based on the current web page.
[0096] After jumping to the next level webpage, the next level webpage is re-determined as the current webpage. The current webpage is detected for abnormal conditions. The current webpage is jumped by triggering the area to be detected, and the abnormal condition detection of the current webpage is performed to obtain the abnormal detection result of the area to be detected.
[0097] The detection of abnormal conditions may include detecting whether the current web page has a page blank abnormality, a page access abnormality, a thumbnail missing abnormality, a garbled text abnormality, and one or more abnormal conditions of a pop-up window. The present application embodiment provides a specific implementation method of S204, i.e., detecting the abnormal condition of the current web page and obtaining the abnormal detection result corresponding to the tested area in the previous level web page of the current web page, for details, please refer to the following.
[0098] S205: When the preset condition is not met, re-execute the page screenshot of the current web page and the subsequent steps.
[0099] The preset condition is a condition for stopping the test on the current page. The preset condition may be a cutoff condition, or all the areas to be tested in the current web page are triggered. The cutoff condition may be one or more of jumping to a web page that does not need to be tested, jumping to a web page that cannot be detected for anomalies, the number of triggers reaching a preset number threshold, the web page stay time reaching a preset time threshold, jumping to the query homepage of the website, and jumping to the category query page of the website.
[0100] If the preset condition is not met, the current web page needs to be tested, and the above S201 is executed again, that is, a screenshot of the current web page is obtained, and subsequent steps are performed.
[0101] S206: When the preset condition is met, jump back to the previous level web page from the current web page, re-determine the web page after the jump as the current web page, and judge again whether the preset condition is met. If not, continue to execute according to the trigger record, trigger the test area in the current web page and subsequent steps in sequence according to the trigger sequence.
[0102] If the result of the second determination is that the preset condition is met, the test of the current web page is stopped, and the current web page is jumped back to the previous web page, and the previous web page jumped back is used as the current web page.
[0103] After jumping back from the current web page to the previous web page and re-determining the web page after the jump as the current web page, if the preset condition is not met at this time, the area to be tested will continue to be triggered on the current web page, that is, the previous web page to which the jump is returned. According to the trigger record of the current web page, the area to be tested is triggered in the current web page in sequence according to the triggering order, and the subsequent test steps are performed.
[0104] Based on the above S201-S206, it can be known that by determining the area to be tested in the current web page, triggering the area to be tested according to the triggering order, and performing abnormal detection on the web page after jumping, the area to be tested can be automatically tested. By jumping back to the previous web page and continuing to trigger the area to be tested according to the trigger record, a more comprehensive detection of the area to be tested in the current web page can be achieved, thereby improving the efficiency of web page testing. By triggering the area to be tested and automatically testing web pages at multiple levels, it is possible to efficiently test web pages in a larger range.
[0105] This application embodiment provides a specific implementation of a web page testing method. Figure 3 As shown, the figure is a schematic flow chart of a web page testing method provided in an embodiment of the present application, including S301-S308.
[0106] S301: Obtain a screenshot of the current web page.
[0107] S302: Determine at least one area to be tested in the current web page according to the page screenshot.
[0108] S303: triggering the areas to be tested in the current web page in sequence according to the triggering record and in a triggering order, and updating the triggering record.
[0109] S304: If the tested area is triggered and the page jumps to the next level, the page after the jump is re-determined as the current page, the abnormality of the current page is detected, and the abnormality detection result corresponding to the tested area in the previous level page of the current page is obtained.
[0110] For the relevant description of S301-S304, please refer to the above S201-S204.
[0111] S305: Determine whether a preset condition is met.
[0112] Specifically, the preset condition may be a preset cutoff condition, or all the areas to be tested in the current webpage are triggered.
[0113] If the preset condition is met, execute S306.
[0114] If the preset condition is not met, the process returns to execute S301 and subsequent steps.
[0115] S306: Determine whether the current web page is a first-level web page.
[0116] If the current web page is a first-level web page, the test of the web page is completed and the test ends.
[0117] If the current web page is not a first-level web page, execute S307.
[0118] S307: Jump back from the current web page to the previous web page, and re-determine the web page after the jump as the current web page.
[0119] S308: Determine whether a preset condition is met. Specifically, the preset condition is a preset cutoff condition, or all the areas to be tested in the current webpage are triggered.
[0120] If the preset condition is met, execute S306.
[0121] If the preset condition is not met, it is necessary to continue to trigger the area to be tested on the current webpage, and return to execute S303 and subsequent steps.
[0122] The following takes the test of the three-level web page as an example to illustrate the above steps S301-S308. The level of the web page is determined according to the number of jumps from the initial test web page to the web page. The web page initially tested is the first-level web page.
[0123] Determine the first-level web page A as the current web page. First obtain a page screenshot of the current web page (web page A), and determine based on the page screenshot that the current web page (web page A) includes two areas to be tested, namely area 1 to be tested and area 2 to be tested. The trigger record specifically shows that both area 1 to be tested and area 2 to be tested are not triggered. According to the trigger record, in the triggering order of area 1 to be tested first and area 2 to be tested later, area 1 to be tested is triggered, and the trigger record is updated. After the trigger record is updated, the trigger record specifically shows that area 2 to be tested is not triggered. After area 1 to be tested is triggered, jump to the next level, which is the second-level web page B.
[0124] The second-level web page B is determined as the current web page, and the abnormality of the current web page (web page B) is detected to obtain the abnormality detection result corresponding to the area to be tested 1. The current judgment does not meet the preset condition, and then a page screenshot of the current web page (web page B) is obtained to determine that the current web page (web page B) has an area to be tested, that is, the area to be tested 3. The trigger record of the current web page (web page B) is that the area to be tested 3 is not triggered. Then, the area to be tested 3 of the current web page (web page B) is triggered according to the trigger sequence, and the trigger record is updated. After the area to be tested 3 is triggered, jump to the next level, that is, the third-level web page C.
[0125] The third-level web page C is determined as the current web page. The current web page (web page C) is tested for abnormalities, and the corresponding abnormality detection result of the test area 3 is obtained. Web page C is a web page that does not need to be tested, and the preset conditions are met. The current web page (web page C) is not a first-level web page, and jumps from the current web page (web page C) to the previous-level web page (web page B).
[0126] Then, web page B is used as the current web page. According to the trigger record of web page B, it can be determined that the areas to be detected of web page B have all been triggered and the preset conditions have been met. In addition, the current web page (web page B) is not a first-level web page, and the page jumps from the current web page (web page B) to the previous-level web page (web page A).
[0127] If the preset condition is not met, the area to be tested 2 is triggered according to the triggering record of web page A in the triggering order. Triggering the area to be tested 2 fails to achieve a web page jump, and the preset condition of triggering all the areas to be tested is met. If the current web page (web page A) is a first-level web page, the test of the web page is completed.
[0128] Based on the above content, it can be known that by triggering the area to be tested and automatically testing web pages at multiple levels, it is possible to efficiently implement testing of web pages in a larger range.
[0129] For different types of web pages, the areas in the web pages that can trigger the web page jump are different. In a possible implementation, the embodiment of the present application provides a specific implementation of S202, that is, determining at least one area to be tested in the current web page according to the page screenshot, including the following four steps.
[0130] A1: Determine the webpage type of the current webpage.
[0131] Web page types can be divided according to whether they are search results pages obtained by users. Web page types include search results pages and non-search results pages. The search results page is the web page that includes search results to which the user is redirected after triggering the search function. For example, the user enters "hypertension" in the input bar and clicks the "Search" button to jump to the page that includes search results related to "hypertension". The page that includes search results related to "hypertension" is the search results page. Non-search results pages are pages other than search results pages. A non-search results page can be a page that includes the specific content of a search result to which the user is redirected after clicking on the search result. Taking the above search for "hypertension" as an example, the page that the user is redirected to after clicking on the first search result in the search results page is a non-search results page.
[0132] The webpage type can be specifically determined by the webpage source code of the webpage. The present application embodiment provides a specific implementation method A1, that is, determining the webpage type of the current webpage, which is described below.
[0133] A2: If the web page type is a search result page, the page screenshot is input into the target detection model to obtain the area to be tested in the page screenshot; the target detection model is trained by the first historical page screenshot and the label of the area to be tested in the first historical page screenshot.
[0134] Since the page structure of the search results page is relatively fixed, the target detection model can be used to identify the area to be tested in the search results page.
[0135] The target detection model is a model for dividing the page screenshot of the web page belonging to the search result page into a to-be-tested area. In a possible implementation, the target detection model may be composed of CenterNet.
[0136] The target detection model is trained by the first historical page screenshot and the test area label in the first historical page screenshot. The first historical page screenshot is obtained by taking a screenshot of the search result page displayed historically. The test area label is obtained by marking the test area after dividing the first historical page screenshot into the test area.
[0137] After determining that the current web page is a search result page, a page screenshot of the current web page is input into the target detection model to obtain a region to be tested in the page screenshot output by the target detection model.
[0138] A3: If the webpage type is not a search result page, convert the page screenshot into a grayscale image, extract the edges of the grayscale image and then perform dilation processing to generate a binary image, and obtain the connected areas in the binary image; determine the minimum circumscribed rectangle of each connected area as the area to be tested in the page screenshot.
[0139] If the webpage type of the current webpage is a non-search result page, image processing is performed on the page screenshot to determine the area to be tested in the page screenshot.
[0140] Specifically, the page screenshot can be converted into a grayscale image first. Then the edge of the obtained grayscale image is extracted, and the edge extraction can obtain a binary image including edge pixels. Then the binary image is expanded using a dilation algorithm. The expansion process can make some edge parts connected to obtain a connected area in the binary image. Finally, the minimum bounding rectangle of each connected area in the binary image is determined, and the area included in the minimum bounding rectangle of each connected area is determined as the area to be tested in the page screenshot.
[0141] A4: Map the area to be tested in the page screenshot to the current web page to obtain at least one area to be tested in the current web page.
[0142] By processing the screenshots of the two different types of web pages, search result pages and non-search result pages, the area to be tested in the screenshots can be obtained. Then, the area to be tested in the screenshots can be mapped to the current web page to determine the area to be tested in the current web page.
[0143] In the embodiment of the present application, the area to be tested in the page screenshot is determined in a corresponding manner according to the webpage type of the current webpage. The area to be tested in the current webpage can be determined more accurately based on the webpage type, making the test method of implementing the test by triggering the area to be tested more effective.
[0144] Furthermore, the embodiment of the present application provides a specific implementation method of A1, i.e., determining the webpage type of the current webpage, which specifically includes the following three steps:
[0145] B1: Obtain the webpage source code of the current webpage, and identify the first target identifier from the webpage source code.
[0146] After determining the current web page, the web page source code of the current web page is obtained. The web page source code is the code required to generate the web page. The web page source code includes information related to the current web page.
[0147] The first target identifier is an identifier in the webpage source code indicating that the webpage type is a search result page. The first target identifier, for example, can be a keyword indicating a search result page.
[0148] B2: If the first target identifier is identified from the webpage source code, the webpage type of the current webpage is determined to be a search result page.
[0149] If the first target identifier can be identified in the webpage source code, it can be determined that the webpage type of the current webpage is a search result page.
[0150] B3: If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
[0151] If the first target identifier cannot be identified in the webpage source code, it means that the current webpage is not a search result page. The webpage type of the current webpage is determined as a non-search result page.
[0152] Based on the above content, it can be known that by identifying the first target identifier in the webpage source code, the webpage type of the current webpage can be determined more accurately, and then the page screenshot can be processed in a corresponding manner to obtain a more accurate area to be tested.
[0153] In some possible cases, the area to be tested may be an area that cannot be triggered to achieve web page jump. Triggering such an area to be tested will reduce the test efficiency. Therefore, the triggering order of the areas to be tested can be sorted, and the areas that are more likely to achieve web page jump can be triggered first.
[0154] Based on this, the embodiment of the present application provides another web page testing method, which, in addition to the above steps, may also include a method for determining a triggering sequence of the areas to be tested, specifically including the following three steps:
[0155] C1: Input the page screenshot into the thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained through the second historical page screenshot and the thermal value distribution in the actual clickable area in the second historical page screenshot.
[0156] The thermal value detection model is a model used to measure the clickability probability of each pixel in the image. The thermal value detection model is trained by the thermal value distribution of the actual clickable area in the second historical page screenshot and the second historical page screenshot. In a possible implementation, the thermal value detection model can be based on the efficientnet-b0 network model structure and PANet (Path Aggregation Network).
[0157] The second historical page screenshot is obtained by taking a screenshot of the web page displayed historically. The second historical page screenshot includes an actual clickable area. The actual clickable area refers to an area that can trigger a web page jump by clicking. For example, the search results for the search term entered by the user may include a term card for the search term. The user can jump to the web page by clicking the area where the term card is located, and the area where the term card is located is the actual clickable area.
[0158] In the actual clickable area, the probability of each pixel being clicked is not the same. For example, the probability of the pixel at the center of the actual clickable area being clicked is higher, and the probability of the pixel at the edge being clicked is lower. To this end, the thermal value distribution in the actual clickable area is determined. The thermal value distribution represents the distribution of the probability of different pixels being clicked in the actual clickable area.
[0159] In a possible implementation, the pixel point at the center of the actual clickable area can be determined as the pixel point with the highest click probability, and the thermal value distribution from the pixel point at the center to the pixel point at the edge conforms to the Gaussian distribution. In addition, the pixel point values of the pixels in each actual clickable area can be adjusted so that the sum of the pixel points in each actual clickable area is the same value, or the sum of the pixel points in each actual clickable area is smaller. This can reduce the impact of the size of the actual clickable area on the click probability of the actual clickable area.
[0160] The page screenshot is input into the thermal value detection model to obtain the thermal value of each pixel in the page screenshot output by the thermal value detection model.
[0161] C2: Add the thermal values of each pixel in each area to be tested to obtain the sum of the thermal values of the area to be tested.
[0162] Based on the thermal values of each pixel in the page screenshot, the thermal values of each pixel in each area to be tested can be determined. The thermal values of each pixel in each area to be tested are added together to obtain the sum of the thermal values corresponding to the area to be tested. The sum of the thermal values of the area to be tested can reflect the probability that the area to be tested is an actual clickable area.
[0163] C3: Sort the test areas according to the sum of their thermal values to determine the triggering order of the test areas.
[0164] The test areas are sorted according to the thermal values of each test area, and the triggering order of the test areas is determined based on the sorting results.
[0165] For example, the test areas can be sorted from large to small in the order of thermal value, and the sorting result can be used as the triggering order of the test areas. In this way, the test areas with a greater probability of being actual clickable areas can be triggered first, and then the test areas with a smaller probability of being actual clickable areas can be triggered. Triggering the test areas with a greater probability of being actual clickable areas first can improve the effectiveness of the test.
[0166] In the embodiment of the present application, the triggering order of the areas to be tested is determined according to the sum of their thermal values, so that the areas to be tested that are most likely to be actual clickable areas can be tested first, thereby improving the effectiveness of web page testing.
[0167] The abnormality of a web page refers to a situation where the web page cannot be displayed normally, or other interference factors affect the normal display of the web page. The present application embodiment provides a specific implementation of S204, i.e., detecting the abnormality of the current web page and obtaining the abnormality detection result corresponding to the tested area in the previous level web page of the current web page, which specifically includes:
[0168] Detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the area to be tested in the previous level web page of the current web page.
[0169] Abnormal situations may specifically include page blank abnormality, page access abnormality, thumbnail missing abnormality, garbled text abnormality, and one or more of the following pop-up windows. Among them, page blank abnormality refers to the abnormal situation that the page is blank and the display content does not appear normally. Page access abnormality refers to the abnormal situation that the page cannot be accessed normally. For example, a 404 or 502 error appears after the web page jumps. Thumbnail missing abnormality refers to the abnormal situation that the thumbnail is missing from the page, which may specifically refer to the situation where the thumbnail display is abnormal or the thumbnail file cannot be accessed normally, resulting in the loss of the thumbnail. Garbled text abnormality refers to the abnormal situation that the text part of the page cannot be displayed normally and garbled characters are displayed. The existence of a pop-up window refers to the existence of a pop-up window area on the page that is unrelated to the content displayed on the page.
[0170] The current web page is tested for abnormalities to obtain abnormality detection results. Based on the obtained detection results, the abnormality detection results corresponding to the area to be tested in the previous web page of the current web page that triggers the jump to the current web page can be determined.
[0171] Furthermore, the embodiment of the present application also provides a specific implementation method for detecting whether the current web page has one or more abnormal conditions such as page blanking anomaly, page access anomaly, thumbnail missing anomaly, garbled text anomaly, and pop-up window anomaly. Based on the specific abnormality type included in the abnormal condition, the detection of the abnormal condition includes one or more of the following steps:
[0172] D1: Detect whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold. If it is greater than the pixel number threshold, determine that there is a page blank abnormality in the current webpage.
[0173] For page blanking anomalies, detection can be achieved by detecting the number of white pixels in the page screenshot of the current web page. By judging whether the number of white pixels in the page screenshot is greater than a pixel number threshold, it can be determined whether the current web page has page blanking anomalies. The pixel number threshold can be a predetermined minimum value of the number of white pixels on a blank page.
[0174] D2: Detect the status identifier of the current web page. If the status identifier is the second target identifier, determine that there is a page access anomaly in the current web page.
[0175] The page access anomaly can be determined by the state of the current web page. The state identifier of the current web page is detected. If the state identifier is the second target identifier representing the access anomaly, it can be determined that the current web page has a page access anomaly. In a possible implementation, the return value of the URL (Uniform Resource Locator) address of the page can be used as the state identifier.
[0176] D3: Detect whether there is a preset target image in the page screenshot of the current webpage. If there is a preset target image, determine that there is a thumbnail missing anomaly in the current webpage.
[0177] For thumbnail missing exceptions, a preset target image can be detected on the page screenshot of the current web page. The preset target image is an image used to represent the missing thumbnail. For example, the preset target image can be a substitute image displayed on the page when the thumbnail is missing. Specifically, an image detection algorithm can be used to detect whether there is a preset target image in the page screenshot.
[0178] If a preset target image for indicating thumbnail missing exists in the page screenshot of the current webpage, it can be determined that a thumbnail missing anomaly exists in the current webpage.
[0179] D4: Obtain the text included in the current webpage, identify whether the text contains garbled characters, and if so, determine that the current webpage contains garbled characters abnormality.
[0180] For the garbled text exception, the text included in the webpage can be obtained through the webpage source code of the current webpage, and the garbled text can be identified. In a possible implementation, the text included in the page can be extracted first, and then the text can be classified. According to the result of the text classification, it is determined whether there is garbled text. Among them, Selenium (a webpage automation tool) can be used to extract the text included in the page, and the fast-text model can be used to classify the text.
[0181] If the result of the text recognition is that garbled text exists, it can be determined that garbled text anomalies exist in the current web page.
[0182] D5: Classify and identify whether the screenshot of the current webpage includes a pop-up window page. If the classification and identification result shows that a pop-up window page exists, it is determined that the current webpage has a pop-up window.
[0183] If there is a pop-up window, the screenshot of the current web page can be subjected to image classification. If the result of the image classification is that there is a pop-up window page, it can be determined that there is a pop-up window in the current web page.
[0184] In a possible implementation, the mobilenetv2 model may be used to classify page screenshots.
[0185] Based on the above content, it can be seen that by automatically detecting abnormal situations that may occur in the current web page, automatic web page detection can be achieved, improving the efficiency of web page testing. It can also detect multiple abnormal situations, making abnormality detection more comprehensive.
[0186] Based on the web page testing method provided by the above method embodiment, the embodiment of the present application also provides a web page testing device, which is explained and illustrated below in conjunction with the accompanying drawings.
[0187] See also Figure 4 As shown, this figure is a schematic diagram of the structure of a web page testing device provided in an embodiment of the present application. The web page testing device provided in an embodiment of the present application includes:
[0188] The acquisition unit 401 is used to acquire a screenshot of the current web page;
[0189] A determination unit 402, configured to determine at least one area to be tested in the current web page according to the page screenshot;
[0190] A trigger unit 403, configured to trigger the areas to be tested in the current web page in sequence according to the trigger record and the triggering order, and update the trigger record;
[0191] The detection unit 404 is used to, if the to-be-tested area jumps to the next-level webpage after the triggering, re-determine the webpage after the jump as the current webpage, detect the abnormality of the current webpage, and obtain the abnormality detection result corresponding to the to-be-tested area in the previous-level webpage of the current webpage;
[0192] The first execution unit 405 is used to re-execute the steps of obtaining a screenshot of the current webpage and subsequent steps when the preset condition is not met;
[0193] The second execution unit 406 is used to jump from the current web page back to the previous level web page when the preset condition is met, redetermine the web page after the jump as the current web page, and again determine whether the preset condition is met. If not, continue to execute the trigger record, trigger the area to be tested in the current web page and subsequent steps in sequence according to the trigger order.
[0194] In a possible implementation manner, the preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
[0195] In a possible implementation, the determining unit 402 includes:
[0196] A determination subunit, used to determine the webpage type of the current webpage;
[0197] A first acquisition subunit is used for inputting the page screenshot into a target detection model to obtain a region to be tested in the page screenshot if the webpage type is a search result page; the target detection model is trained by the first historical page screenshot and the label of the region to be tested in the first historical page screenshot;
[0198] The second acquisition subunit is used for converting the page screenshot into a grayscale image if the webpage type is a non-search result page, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, and obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each of the connected areas as the area to be tested in the page screenshot;
[0199] The mapping subunit is used to map the area to be tested in the page screenshot to the current web page to obtain at least one area to be tested in the current web page.
[0200] In a possible implementation, the determining subunit is specifically configured to obtain a webpage source code of the current webpage, and identify a first target identifier from the webpage source code;
[0201] If a first target identifier is identified from the webpage source code, determining the webpage type of the current webpage as a search result page;
[0202] If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
[0203] In a possible implementation manner, the device further includes:
[0204] An input unit, used for inputting the page screenshot into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution in the actual clickable area in the second historical page screenshot;
[0205] A calculation unit, used for adding the thermal values of each pixel in each of the areas to be tested to obtain the sum of the thermal values of the area to be tested;
[0206] A sorting unit is used to sort the areas to be tested according to the sum of the thermal values of the areas to be tested, and determine the triggering order of the areas to be tested.
[0207] In one possible implementation, the detection unit 404 is specifically used to detect whether the current web page has a page blank anomaly, a page access anomaly, a thumbnail missing anomaly, a garbled text anomaly, and one or more anomalies in a pop-up window, and obtain the anomaly detection result corresponding to the tested area in the previous level web page of the current web page.
[0208] In a possible implementation, the detection unit 404 includes the following detection subunit or multiple detection subunits:
[0209] The first detection subunit is used to detect whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, it is determined that the current webpage has a page blanking anomaly;
[0210] A second detection subunit detects a status identifier of the current webpage, and if the status identifier is a second target identifier, determines that a page access anomaly exists in the current webpage;
[0211] A third detection subunit detects whether there is a preset target image in the page screenshot of the current webpage, and if the preset target image exists, determines that there is a thumbnail missing abnormality in the current webpage;
[0212] A fourth detection subunit is configured to obtain text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text anomaly;
[0213] The fifth detection subunit classifies and identifies whether the page screenshot of the current web page includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current web page has a pop-up window.
[0214] Figure 5 A block diagram of a testing device 500 for a web page is shown. For example, the device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0215] Reference Figure 5 , device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .
[0216] The processing component 502 generally controls the overall operation of the device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.
[0217] The memory 504 is configured to store various types of data to support operations on the device 500. Examples of such data include instructions for any application or method operating on the device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0218] Power supply component 506 provides power to various components of device 500. Power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 500.
[0219] The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0220] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the device 500 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.
[0221] The I / O interface provides an interface between the processing component 502 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0222] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 514 can detect the open / closed state of the device 500, the relative positioning of components, such as the display and keypad of the device 500, and the sensor assembly 514 can also detect the position change of the device 500 or a component of the device 500, the presence or absence of user contact with the device 500, the orientation or acceleration / deceleration of the device 500, and the temperature change of the device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0223] The communication component 516 is configured to facilitate wired or wireless communication between the device 500 and other devices. The device 500 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0224] In an exemplary embodiment, the device 500 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:
[0225] Get a screenshot of the current web page;
[0226] Determine at least one area to be tested in the current web page according to the page screenshot;
[0227] According to the trigger record, triggering the areas to be tested in the current web page in sequence according to the trigger order, and updating the trigger record;
[0228] If the tested area is triggered and the page jumps to the next level, the page after the jump is re-determined as the current page, the abnormality of the current page is detected, and the abnormality detection result corresponding to the tested area in the previous level page of the current page is obtained;
[0229] When the preset condition is not met, re-execute the steps of obtaining a screenshot of the current web page and subsequent steps;
[0230] When the preset condition is met, jump back to the previous level web page from the current web page, re-determine the web page after the jump as the current web page, and judge again whether the preset condition is met. If not, continue to execute the trigger record, trigger the test area and subsequent steps in the current web page in sequence according to the trigger order.
[0231] In a possible implementation manner, the preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
[0232] In a possible implementation, determining at least one area to be tested in the current webpage according to the page screenshot includes:
[0233] Determine the webpage type of the current webpage;
[0234] If the webpage type is a search result page, input the page screenshot into a target detection model to obtain a region to be tested in the page screenshot; the target detection model is trained by the first historical page screenshot and a label of the region to be tested in the first historical page screenshot;
[0235] If the webpage type is a non-search result page, converting the page screenshot into a grayscale image, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each connected area as the area to be tested in the page screenshot;
[0236] The area to be tested in the page screenshot is mapped to the current web page to obtain at least one area to be tested in the current web page.
[0237] In a possible implementation manner, determining the webpage type of the current webpage includes:
[0238] Obtaining a webpage source code of the current webpage, and identifying a first target identifier from the webpage source code;
[0239] If a first target identifier is identified from the webpage source code, determining the webpage type of the current webpage as a search result page;
[0240] If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
[0241] In a possible implementation manner, the instruction further includes:
[0242] Inputting the page screenshot into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution within the actual clickable area in the second historical page screenshot;
[0243] Adding the thermal values of each pixel in each of the to-be-tested areas to obtain the sum of the thermal values of the to-be-tested area;
[0244] The areas to be tested are sorted according to the sum of the thermal values of the areas to be tested, and a triggering order of the areas to be tested is determined.
[0245] In a possible implementation, detecting an abnormality of the current webpage and obtaining an abnormality detection result corresponding to the to-be-tested area in a webpage one level above the current webpage includes:
[0246] Detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the tested area in the previous level web page of the current web page.
[0247] In a possible implementation, the detecting whether the current webpage has one or more abnormal conditions such as page blanking anomaly, page access anomaly, thumbnail missing anomaly, garbled text anomaly, and pop-up window anomaly includes one or more of the following:
[0248] Detecting whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, determining that the current webpage has a page blanking anomaly;
[0249] Detecting a status identifier of the current webpage, and if the status identifier is a second target identifier, determining that a page access anomaly exists in the current webpage;
[0250] Detecting whether there is a preset target image in the page screenshot of the current webpage, and if there is a preset target image, determining that there is a thumbnail missing exception in the current webpage;
[0251] Acquire the text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text exception;
[0252] The page screenshot of the current webpage is classified and identified to determine whether it includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current webpage has a pop-up window.
[0253] Figure 66 is a schematic diagram of the structure of the server in the embodiment of the present invention. The server 600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 622 (for example, one or more processors) and memory 632, and one or more storage media 630 (for example, one or more mass storage devices) storing application programs 642 or data 644. Among them, the memory 632 and the storage medium 630 may be temporary storage or permanent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 622 may be configured to communicate with the storage medium 630, and execute a series of test method instruction operations for executing the above-mentioned web page in the storage medium 630 on the server 600.
[0254] The server 600 may also include one or more power supplies 626, one or more wired or wireless network interfaces 650, one or more input and output interfaces 656, one or more keyboards 656, and / or one or more operating systems 641, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0255] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0256] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0257] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0258] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0259] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A web page testing method, characterized in that: The method comprises: Get a screenshot of the current web page; Determine at least one area to be tested in the current web page according to the page screenshot; According to the trigger record, triggering the areas to be tested in the current web page in sequence according to the trigger order, and updating the trigger record; If the tested area is triggered and the page jumps to the next level, the page after the jump is re-determined as the current page, the abnormality of the current page is detected, and the abnormality detection result corresponding to the tested area in the previous level page of the current page is obtained; When the preset condition is not met, re-execute the steps of obtaining a screenshot of the current web page and subsequent steps; When the preset condition is met, jump back to the previous level webpage from the current webpage, re-determine the webpage after the jump as the current webpage, and again determine whether the preset condition is met. If not, continue to execute the steps of triggering the areas to be tested in the current webpage in sequence according to the triggering sequence according to the triggering record and subsequent steps; Wherein, determining at least one area to be tested in the current webpage according to the page screenshot includes: Determine the webpage type of the current webpage; If the webpage type is a search result page, input the page screenshot into a target detection model to obtain a region to be tested in the page screenshot; the target detection model is trained by the first historical page screenshot and a label of the region to be tested in the first historical page screenshot; If the webpage type is a non-search result page, converting the page screenshot into a grayscale image, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each connected area as the area to be tested in the page screenshot; The area to be tested in the page screenshot is mapped to the current web page to obtain at least one area to be tested in the current web page.
2. The method according to claim 1, characterized in that The preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
3. The method according to claim 1, characterized in that: Determining the webpage type of the current webpage includes: Obtaining a webpage source code of the current webpage, and identifying a first target identifier from the webpage source code; If a first target identifier is identified from the webpage source code, determining the webpage type of the current webpage as a search result page; If the first target identifier is not identified from the webpage source code, the webpage type of the current webpage is determined to be a non-search result page.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: The page screenshot is input into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution within the actual clickable area in the second historical page screenshot; Adding the thermal values of each pixel in each of the to-be-tested areas to obtain the sum of the thermal values of the to-be-tested areas; The areas to be tested are sorted according to the sum of the thermal values of the areas to be tested, and a triggering order of the areas to be tested is determined.
5. The method according to claim 1 or 2, characterized in that: The detecting an abnormality of the current webpage and obtaining an abnormality detection result corresponding to the to-be-tested area in the previous-level webpage of the current webpage includes: Detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the area to be tested in the previous level web page of the current web page.
6. The method according to claim 5, characterized in that The detecting whether the current web page has a blank page exception, a page access exception, a thumbnail missing exception, a garbled text exception, and one or more abnormal conditions in a pop-up window includes one or more of the following: Detecting whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, determining that the current webpage has a page blanking anomaly; Detecting a status identifier of the current webpage, and if the status identifier is a second target identifier, determining that a page access anomaly exists in the current webpage; Detecting whether there is a preset target image in the page screenshot of the current webpage, and if there is a preset target image, determining that there is a thumbnail missing exception in the current webpage; Acquire the text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text exception; The page screenshot of the current webpage is classified and identified to determine whether it includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current webpage has a pop-up window.
7. A web page testing device, characterized in that: The device comprises: An acquisition unit, used to acquire a screenshot of the current web page; A determination unit, configured to determine at least one area to be tested in the current web page according to the page screenshot; A trigger unit, configured to trigger the areas to be tested in the current web page in sequence according to the trigger record and the triggering sequence, and update the trigger record; A detection unit, for if the to-be-tested area is triggered and the webpage to the next level is jumped, re-determines the webpage after the jump as the current webpage, detects the abnormality of the current webpage, and obtains the abnormality detection result corresponding to the to-be-tested area in the webpage of the previous level of the current webpage; A first execution unit, configured to re-execute the steps of obtaining a screenshot of the current web page and subsequent steps when a preset condition is not met; A second execution unit is used to jump back to the previous level webpage from the current webpage when the preset condition is met, re-determine the webpage after the jump as the current webpage, and again determine whether the preset condition is met. If not, continue to execute the steps of triggering the areas to be tested in the current webpage in sequence according to the triggering order according to the triggering record and subsequent steps; Wherein, the determining unit includes: A determination subunit, used to determine the webpage type of the current webpage; A first acquisition subunit is used for inputting the page screenshot into a target detection model to obtain a region to be tested in the page screenshot if the webpage type is a search result page; the target detection model is trained by the first historical page screenshot and the label of the region to be tested in the first historical page screenshot; The second acquisition subunit is used for converting the page screenshot into a grayscale image if the webpage type is a non-search result page, extracting edges of the grayscale image and then performing dilation processing to generate a binary image, and obtaining connected areas in the binary image; and determining the minimum circumscribed rectangle of each of the connected areas as the area to be tested in the page screenshot; The mapping subunit is used to map the area to be tested in the page screenshot to the current web page to obtain at least one area to be tested in the current web page.
8. The device according to claim 7, characterized in that The preset condition is a preset cutoff condition or all the areas to be tested in the current webpage are triggered.
9. The device according to claim 7 or 8, characterized in that The device also includes: An input unit, used for inputting the page screenshot into a thermal value detection model to obtain the thermal value of each pixel in the page screenshot; the thermal value detection model is trained by the second historical page screenshot and the thermal value distribution in the actual clickable area in the second historical page screenshot; A calculation unit, used for adding the thermal values of each pixel in each of the areas to be tested to obtain the sum of the thermal values of the area to be tested; A sorting unit is used to sort the areas to be tested according to the sum of the thermal values of the areas to be tested, and determine the triggering order of the areas to be tested.
10. The device according to claim 7 or 8, characterized in that The detection unit is specifically used to detect whether the current web page has page blank anomalies, page access anomalies, thumbnail missing anomalies, garbled text anomalies, and one or more anomalies in pop-up windows, and obtain the anomaly detection result corresponding to the tested area in the previous level web page of the current web page.
11. The device according to claim 10, characterized in that The detection unit includes one or more detection subunits as follows: The first detection subunit is used to detect whether the number of white pixels in the page screenshot of the current webpage is greater than a pixel number threshold, and if so, it is determined that the current webpage has a page blanking anomaly; A second detection subunit detects a status identifier of the current webpage, and if the status identifier is a second target identifier, determines that a page access anomaly exists in the current webpage; A third detection subunit detects whether there is a preset target image in the page screenshot of the current webpage, and if the preset target image exists, determines that there is a thumbnail missing abnormality in the current webpage; A fourth detection subunit is configured to obtain text included in the current webpage, identify whether the text contains garbled text, and if so, determine that the current webpage contains garbled text anomaly; The fifth detection subunit classifies and identifies whether the page screenshot of the current web page includes a pop-up window page. If the classification and identification result shows that the pop-up window page exists, it is determined that the current web page has a pop-up window.
12. A web page testing device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to perform the web page testing method described in one or more of claims 1 to 6.
13. A computer readable medium, characterized in that Instructions are stored thereon, which, when executed by one or more processors, cause the device to execute the web page testing method described in one or more of claims 1 to 6.
