1. Scenario Description
Test the registry form on a page of the website. The form contains several text input boxes and two password input boxes: logon password and Confirm Password. The logon password can only consist of digits or letters and must be between 6 and 20 characters. Make sure that the password is exactly the same as the logon password. After all the preceding conditions are met, you can successfully submit a registry ticket, otherwise, an error message is displayed on the right of the non-conforming input box.
2. Problem Description
During Repeated input tests on the login password and Confirm Password Input boxes in the Chrome browser, it is found that the CPU usage of the browser is constantly increasing, resulting in choppy pages and no response, however, this problem does not occur when you test other text input boxes in the same browser or in other browsers. Therefore, it is suspected that the problem is caused by a Javascript script related to the password input box.
3. Test Method
The Chrome browser developer tool records the CPU usage of a single JavaScript function in a certain period of time. Press F12 on the keyboard to open the developer tool and switch to the profiles page, as shown below:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/33/EC/wKioL1Oql23y_iYOAAIWz5WQIOg374.jpg "Title =" q1.jpg "alt =" wkiol1oql23y_iyoaaiwz5wqiog374.jpg "/>
Select the collect JavaScript CPU profile option and click the start button to start recording. Then, use the same operation test password input box. When the CPU usage increases, click STOP to stop recording. Then, check the left side of the developer tool and find that Chrome has created a record file. Click View File Content to find a JavaScript function with the highest percentage, as shown below:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/33/EE/wKiom1Oql63AFNMJAAM0tUmGGbU934.jpg "Title =" q2.jpg "alt =" wkiom1oql63afnmjaam0tumggbu934.jpg "/>
After query, it is found that the Javascript file where the function is located does not belong to the website itself, but is related to the chrome plug-in. As a result, the search engine found that the file originated from the chrome plug-in of QQ Manager. The plug-in will perform some security-related checks when entering the password, when the operation frequency is high, the CPU usage will soar in a short period of time. Open Chrome's Extension Manager, find and disable the QQ manager plug-in, and then test again to confirm that the problem has been resolved, as shown below:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/33/F0/wKioL1Oql6vjm2OPAADRnLvRjV0285.jpg "Title =" q3.jpg "alt =" wkiol1oql6vjm2opaadrnlv1_v0285.jpg "/>
This article is from the "Fangyuan" blog and will not be reposted!