Website adaptation problem detection method, device and storage medium
The browser automatically detects website adaptation issues, analyzes page loading content and preset rules, and records code snippets that do not comply with the rules. This solves the time-consuming problem of manual positioning, achieves efficient and convenient website adaptation detection, and improves user experience.
Patent Information
- Application Number
- CN202111503363.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In the existing technology, manually checking the website source code to locate browser adaptation problems is time-consuming, cannot efficiently discover incompatibility issues that users have not reported, and requires a high level of knowledge and experience from the testers.
Obtain page loading content through the browser, analyze whether it complies with preset rules, record web page code snippets that do not comply with the rules, use browser plug-ins to automatically detect website adaptation issues, and support various browsers and versions.
It improves the efficiency and convenience of detecting website adaptation problems, can detect incompatibility problems that users have not discovered in advance, reduces the knowledge requirements for detection personnel, and improves user experience.
Smart Images

Figure CN114186160B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, and storage medium for detecting website adaptation problems. Background Art
[0002] With the rapid development of browsers, a wide variety of browsers have emerged. Different browsers have varying page loading standards. Even within the same browser, due to updates at different times, newer and older versions may have different page loading standards. This can lead to websites working for one browser but not another, or working for older browsers but not newer ones.
[0003] To address these issues, manual intervention is currently the primary approach. This involves manually inspecting the website's source code to identify the root cause of the problem when a website is found to be incompatible with a particular browser. The source code is then adjusted to make it compatible with the browser in question.
[0004] However, manually checking the source code of the website and then finding the root cause of the website not being suitable for the browser from the source code of the website takes a long time to locate the root cause of the problem, thereby reducing the efficiency of detecting website adaptation problems. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a website adaptation problem detection method, device and storage medium to improve the detection efficiency of website adaptation problems.
[0006] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0007] In a first aspect, the present application provides a method for detecting website adaptation problems, which is applied to a browser and includes: obtaining content loaded by the browser in a page; analyzing whether the loaded content complies with preset rules, where the preset rules are a set of situations in which corresponding content cannot be loaded in the browser page; and if so, obtaining a web page code snippet corresponding to the loaded content, and recording the web page code snippet as a problem code.
[0008] A second aspect of the present application provides a website adaptation problem detection device, which is applied to a browser and includes: a collection module for obtaining the content loaded by the browser in a page; an analysis module for analyzing whether the loaded content complies with preset rules, where the preset rules are a set of situations in which the corresponding content cannot be loaded in the page of the browser; and an interception module for, if so, obtaining a web page code fragment corresponding to the loaded content and recording the web page code fragment as a problem code.
[0009] A third aspect of the present application provides a computer-readable storage medium, comprising: a stored program; wherein, when the program is run, the device where the storage medium is located is controlled to execute the method in the first aspect.
[0010] Compared with the prior art, the website adaptation problem detection method provided in the first aspect of this application obtains the loaded content of the browser in the page, and then analyzes whether the loaded content complies with the preset rules. The preset rules are a set of situations in which the corresponding content cannot be loaded in the browser page. If the loaded content is analyzed to comply with the preset rules, it means that the loaded content cannot be displayed normally in the browser page, then the web page code snippet corresponding to the loaded content is obtained, and the web page code snippet is recorded as the problem code. In this way, there is no need for maintenance personnel to check the source code of the website. Through the browser, the web page code snippet corresponding to the incompatible loaded content can be found more quickly, thereby improving the detection efficiency of the website adaptation problem. Moreover, for novices, as long as they can make the browser run, without any other operations, they can obtain the web page code snippet with incompatibility problems, which greatly improves the convenience and universality of website adaptation problem detection. Furthermore, even if some users have not discovered or reported incompatibility issues, the browser can actually detect and analyze the content loaded by the website in the browser, breaking the traditional way of detecting website incompatibility issues, which is to find the problem and then solve it. It can discover incompatibility issues that users have not discovered or reported in advance, and solve these incompatibility issues as soon as possible, which can improve the user experience of the website.
[0011] The website adaptation problem detection device provided in the second aspect of this application and the computer-readable storage medium provided in the third aspect have the same or similar beneficial effects as the website adaptation problem detection method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other objects, features and advantages of the exemplary embodiments of the present application will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0013] Figure 1 This is a flow chart of the website adaptation problem detection method in the embodiment of this application. Figure 1 ;
[0014] Figure 2 This is a flowchart of the browser plug-in generation process in an embodiment of the present application;
[0015] Figure 3 A flowchart of the content analysis process in the embodiment of the present application is shown;
[0016] Figure 4 This is a flowchart of the website debugging process in an embodiment of the present application;
[0017] Figure 5 This is a flow chart of the website adaptation problem detection method in the embodiment of this application. Figure 2 ;
[0018] Figure 6 This is a schematic diagram of the structure of the website adaptation problem detection device in the embodiment of the present application. Figure 1 ;
[0019] Figure 7 This is a schematic diagram of the structure of the website adaptation problem detection device in the embodiment of the present application. Figure 2 . DETAILED DESCRIPTION
[0020] The following describes exemplary embodiments of the present application in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. Instead, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0021] It should be noted that, unless otherwise specified, the technical or scientific terms used in this application should have the common meanings understood by those skilled in the art to which this application belongs.
[0022] Currently, when a website is incompatible with a browser, the primary method is to manually inspect the website's source code to identify the cause of the incompatibility. This allows the source code to be modified to make the website compatible with the browser. For example, when a webpage from a website is loaded into a browser, some images on the website may not display on the page being loaded in the browser due to incompatibility between the website and the browser. In this case, a person needs to manually inspect the source code to identify the code related to the images that are not displayed, and then modify the code so that the images on the website can finally be displayed in the browser.
[0023] The above-mentioned method for detecting website adaptation problems requires manual inspection of the website source code, which takes a long time to locate the root cause of the incompatibility problem. It also requires the knowledge and experience of the tester. In addition, it can only locate and solve the problem reported by the user after the user discovers the problem, and cannot detect incompatibility problems that the user has not discovered in advance.
[0024] In view of this, an embodiment of the present application provides a method for detecting website adaptation problems, which is applied to a browser, and then the content loaded in its page is obtained through the browser, and then the loaded content is compared and analyzed with a preset set of situations (i.e., preset rules) of the corresponding content that cannot be loaded in the page of the browser. If the comparison and analysis finds that it is consistent with the preset rules, it means that the content loaded in the currently obtained browser page cannot be displayed normally in the browser page, then the web page code snippet corresponding to the loaded content is recorded and fed back to inform the maintenance personnel of the corresponding website to make modifications so that the subsequent loaded content can be displayed normally in the page of the above-mentioned browser. In this way, there is no need for personnel to check the source code of the website. Through the browser, the web page code snippet corresponding to the incompatible loaded content can be found more quickly, thereby improving the detection efficiency of website adaptation problems.
[0025] Furthermore, the browser can detect and analyze the content loaded on the page, and when problems are found, the corresponding webpage source code is obtained. This eliminates the need for personnel to view the website source code, reducing the knowledge and experience required of the inspector. Even a novice can obtain the webpage code snippet with incompatibility issues by simply running the browser without any other operation, greatly improving the convenience and universality of website adaptation problem detection.
[0026] In addition, the browser can detect and analyze the content loaded in its page, and then obtain the web page source code corresponding to the loaded content when a problem is found. Even if some users have not discovered or reported incompatibility issues, the browser can actually detect and analyze the content loaded by the website in the browser, breaking the traditional way of detecting website incompatibility issues of finding the problem and then solving it. It can discover incompatibility issues that users have not discovered or reported in advance, and solve these incompatibility issues as soon as possible, which can improve the user experience of the website.
[0027] In practical applications, the website adaptation problem detection method provided in the embodiment of the present application can be applied to various types or versions of browsers. The specific types and versions of browsers to which the website adaptation problem detection method provided in the embodiment of the present application is applicable are not limited here.
[0028] Furthermore, the objects for adaptation problem detection, i.e., websites, can be various websites on the public network, such as Taobao, Baidu, etc. They can also be various websites on the intranet, such as management websites used within an enterprise, etc. The specific types of websites in the embodiments of the present application are not limited here.
[0029] Next, the website adaptation problem detection method provided in the embodiment of the present application is described in detail.
[0030] Figure 1 This is a flow chart of the website adaptation problem detection method in the embodiment of this application. Figure 1 , see Figure 1 As shown, the method may include:
[0031] S101: Obtain the content loaded by the browser in the page.
[0032] In order to detect whether a website is compatible with a browser, the website can be loaded into the browser and run, and then the content loaded in the browser page can be used to determine whether the website is compatible with the browser.
[0033] During the specific implementation process, the browser can obtain the content loaded in its page, that is, the loaded content. Specifically, the browser can obtain the content loaded in the browser page through its built-in monitoring function and calling function. When the browser page starts to load the content of the website, the monitoring function detects that the browser page has started to load the website content, and then controls the calling function to obtain the content currently loaded in the browser page. Of course, the browser can also obtain the loaded content in the page through other methods. The specific acquisition method is not limited here.
[0034] S102: Analyze whether the loaded content complies with preset rules; if so, execute S103.
[0035] The preset rules are a set of situations where the corresponding content cannot be loaded in the browser page.
[0036] After a browser is developed or upgraded, the content that the browser supports or does not support is determined. Furthermore, the attributes or related features of the content that the browser does not support can be integrated to generate a set of situations in which the browser cannot load the corresponding content on the page, i.e., the preset rules.
[0037] In this way, after the loaded content of the browser in the page is obtained, the obtained loaded content can be compared and analyzed with the preset rules to determine whether the obtained loaded content complies with the preset rules.
[0038] For example, suppose the content loaded on a browser page is an image in PNG format. However, the browser only supports loading jpg images. Therefore, the default setting is that the image format is non-jpg. When the browser page begins loading the image, the browser acquires the image and determines that it is in PNG format. The browser then compares and analyzes the PNG image against the default rule for non-jpg images, finding that the PNG image meets the default rule. Therefore, the analysis concludes that the image loaded on the browser page meets the default rule. Consequently, the browser page cannot load the image properly and may display the image with an error or unavailable image indicator. The content loaded on the browser page can include more than just images; it can also include text, links, and other items. The specific content loaded on the browser page is not defined here. Accordingly, the specific content in the default rule depends on the browser's ability to load the image, and is not defined here.
[0039] S103: Obtain a webpage code snippet corresponding to the loaded content, and record the webpage code snippet as a problem code.
[0040] After analyzing that the content loaded in the browser page does not comply with the preset rules, it means that after the content is loaded in the browser page, the content cannot be displayed normally. In order to enable maintenance personnel to quickly find the root cause of the problem and then repair the problem for the website, the embodiment of the present application automatically obtains the web page code fragment corresponding to the loaded content, and then records the obtained web page code fragment as the problem code. In this way, after seeing the record, the maintenance personnel can directly and clearly know where the problem is in the website code, and can directly perform maintenance, which not only improves the efficiency of website adaptation detection, but also improves the efficiency of website maintenance.
[0041] Since each part of the website has a one-to-one correspondence with its corresponding code snippet, once a certain part of the website content is determined, the corresponding webpage code snippet can be directly found and recorded based on the correspondence. The specific method for obtaining the loaded content webpage code snippet and recording it is not limited here.
[0042] After recording the webpage code snippets corresponding to the problematic loaded content, the corresponding problem causes and modification suggestions can be given through the preset mapping relationship. In addition, the records can be further organized to generate a test report for maintenance personnel to review and filter.
[0043] As can be seen from the above content, the website adaptation problem detection method provided by the embodiment of the present application obtains the loaded content of the browser in the page, and then analyzes whether the loaded content complies with the preset rules. The preset rules are a set of situations in which the corresponding content cannot be loaded in the browser page. If it is analyzed that the loaded content complies with the preset rules, it means that the loaded content cannot be displayed normally in the browser page, then the web page code fragment corresponding to the loaded content is obtained, and the web page code fragment is recorded as the problem code. In this way, there is no need for maintenance personnel to check the source code of the website again. Through the browser, the web page code fragment corresponding to the incompatible loaded content can be found more quickly, thereby improving the detection efficiency of the website adaptation problem. Moreover, for novices, as long as they can make the browser run, they can obtain the web page code fragment with incompatibility problems without any other operations, which greatly improves the convenience and universality of website adaptation problem detection. Furthermore, even if some users have not discovered or reported incompatibility issues, the browser can actually detect and analyze the content loaded by the website in the browser, breaking the traditional way of detecting website incompatibility issues, which is to find the problem and then solve it. It can discover incompatibility issues that users have not discovered or reported in advance, and solve these incompatibility issues as soon as possible, which can improve the user experience of the website.
[0044] Furthermore, in order to enable various browsers to obtain the loaded content of their pages, a browser plug-in can be set up and then injected into the browser. In this way, for any type or version of browser, as long as the browser plug-in is added, various browsers can obtain the loaded content of their pages through the browser plug-in, thereby realizing the detection of website adaptation problems.
[0045] Figure 2 This is a flowchart of the browser plug-in generation process in the embodiment of this application, see Figure 2 As shown, before step S101, the following steps may also be included:
[0046] S201: Obtain programming languages supported by the browser.
[0047] Generally speaking, the programming language used when developing browsers is C, while websites loaded into browsers use JavaScript (JS). The plugins or extensions supported by browsers also use JavaScript. To ensure that the generated browser plugin is compatible with the corresponding browser, when generating the browser plugin, it is necessary to know the programming language supported by the target browser in advance. Then, using this programming language to generate the browser plugin can make the generated browser plugin more compatible with the target browser, thereby improving the effectiveness of website adaptation detection.
[0048] S202: Generate a browser plug-in using a programming language supported by the browser.
[0049] Among them, the browser plug-in is used to perform adaptation detection on the website loaded in the browser.
[0050] After obtaining the programming language supported by the browser, you can use that programming language to continue writing the corresponding browser plug-in. Here, you need to write and generate the corresponding browser plug-in based on the specific functions that the browser plug-in needs to implement. When you need to perform adaptation detection on the website loaded in the browser, when writing the browser plug-in, you need to integrate various rules and methods for detecting website adaptation issues in order to generate a browser plug-in that can detect whether the website loaded in the browser is adapted. As for the specific writing method of the browser plug-in, various mature writing methods can be used, and no specific restrictions are made here.
[0051] S203: Load the browser plug-in into the browser.
[0052] After generating a browser plug-in with a website adaptation detection function, once the browser plug-in is installed in a corresponding browser, after the browser runs and loads a website, the browser plug-in can detect whether the loaded website is adapted to the current browser.
[0053] Regarding the timing of installing the browser plug-in in the browser, the browser plug-in can be installed in the browser after the user selects to install the browser plug-in, or it can be installed automatically in the browser. This automatic installation method requires certain prerequisites to be met. This is to avoid forcing users to install unnecessary plug-ins and improve the user experience.
[0054] Specifically, step S203 may include:
[0055] Step A1: Determine whether the browser is installed in the test terminal and whether the test terminal is successfully connected to the network; if both are yes, execute step A2; if at least one of them is no, execute step A3.
[0056] Step A2: Automatically load the browser plug-in into the browser.
[0057] Step A3: Generate a prompt message for prompting whether to install the browser plug-in.
[0058] That is to say, when the browser is installed in the test terminal and the test terminal is successfully connected to the network, it means that the browser is currently being tested through the test terminal, and the test terminal is successfully connected to the network, which also means that the browser of the test terminal can load websites on the public network or the intranet. At this time, the browser plug-in is automatically loaded into the browser, which can just detect the adaptation problem of the website in the browser, and it will not affect the normal use of the website by the application. Without interfering with the user's use of the various functions of the website, the adaptation problem of the website can be detected as early as possible, so that the problem can be discovered and solved as early as possible, which can improve the user experience of the website.
[0059] If the browser is not installed on the test terminal and / or the test terminal is not connected to the Internet, it means that the browser may not be currently being tested. Even if the browser is currently being tested, the website content cannot be loaded into the browser page because the test terminal is not connected to the Internet. In this case, a prompt message can be generated and sent to the user to ask whether to install the browser plug-in. Then, based on the user's selection, the browser plug-in is determined to be installed in the browser. This can avoid forcibly installing the plug-in in the browser, thereby avoiding affecting the user's experience of using the browser or website.
[0060] Since steps S201 to S203 are executed before step S101 , step S101 can be changed to: obtaining the content loaded by the browser in the page through the browser plug-in.
[0061] By installing a browser plug-in in the browser, and then using the browser plug-in to obtain the loaded content of the browser page, no matter what browser it is, as long as the browser plug-in is installed, it can obtain the loaded content of its page, thereby realizing automatic detection of website adaptation problems. This enables various browsers to realize automatic detection of website adaptation problems, improving the universality of browser adaptation problem detection.
[0062] Generally speaking, the plug-ins in the browser or the loaded websites are all written in JS language. Therefore, the browser plug-ins in the embodiments of the present application are generally also written in JS language. In order to enable browsers that only support non-JS languages to use the above-mentioned browser plug-ins to detect website adaptation problems, the browser plug-in generated in JS language can still be installed in the browser that only supports non-JS languages, and then the browser plug-in generates a request in another programming language to obtain the loaded content in the browser page from the server corresponding to the browser, thereby realizing the detection of website adaptation problems.
[0063] Specifically, before executing the changed step S101, the following steps may also be included:
[0064] Step B1: Determine whether the browser supports JS language; if so, execute the modified step S101; if not, execute step B2.
[0065] Step B2: Send a request for obtaining loaded content to the server to which the browser belongs through the browser plug-in, and obtain the loaded content of the browser in the page from the response information of the server to which the browser belongs.
[0066] That is, when both the browser plug-in and the browser support JS, the browser plug-in can directly access the content loaded in the browser's page. If the browser plug-in is written in JS, but the browser doesn't support it, the browser plug-in can send a request to the browser's server. This request can be generated in a non-JS language and is used to request the content loaded in the browser's page. In this way, after receiving and verifying the request, the browser's server can send the content loaded in the browser's page as corresponding information to the browser's client, and the browser plug-in can then access the content loaded in the browser's page.
[0067] Of course, in addition to using the browser plug-in generated in steps S201-S203 above to obtain the content loaded by the browser on the page, the corresponding adaptation problem detection code can also be embedded in the corresponding browser code. Without installing any plug-in, simply running the browser and loading the website can also detect adaptation problems on the loaded website. The specific method for obtaining the content loaded by the browser on the page is not limited here.
[0068] From the above content, it can be seen that by generating a browser plug-in with the same programming language as the browser, and obtaining the loaded content in the browser page through the generated browser plug-in, and then detecting website adaptation problems, various browsers can detect website adaptation problems, thereby improving the universality of website adaptation problem detection. In addition, when the programming language used by the browser plug-in is different from that used by the browser, a request to obtain the loaded content is sent to the server to which the browser belongs through the browser plug-in, and then the loaded content of the browser in the page is obtained from the response information of the server to which the browser belongs, further expanding the scope of browsers applicable to detecting website adaptation problems. In addition, when the browser is installed in the test terminal and the test terminal is successfully connected to the Internet, the browser plug-in is automatically loaded into the browser. Without interfering with the user's use of various functions of the website, the website adaptation problem can be detected as early as possible, so that the problem can be discovered and solved as early as possible, which can improve the user experience of the website.
[0069] Furthermore, to more accurately determine whether a website is compatible with a browser, after obtaining the content loaded by the browser on the page, each attribute or feature behind the loaded content can be analyzed, that is, the preset rules can be refined. This can more comprehensively determine whether the loaded content will load normally on the browser page, thereby improving the accuracy of website adaptation problem detection.
[0070] Figure 3 This is a flowchart of the process of loading content analysis in the embodiment of this application, see Figure 3 As shown, the above step S102 may include:
[0071] Step S301: Determine whether the loaded content is a resource node; if so, execute step S302; if not, execute step S303.
[0072] Step S302: Detect whether the resource content corresponding to the loaded content cannot be loaded normally.
[0073] When the loaded content belongs to a resource node, it means that the content displayed by the node needs to be called from elsewhere. In this case, by detecting whether the resource content corresponding to the loaded content cannot be loaded normally, we can know whether the loaded content can be displayed normally on the browser page.
[0074] In practical applications, a Cascading Style Sheets (CSS) checker can be used to detect the content corresponding to the resource node. The specific type of the CSS checker is not limited here.
[0075] Specifically, the following two methods may be used, but are not limited to, to detect whether the resource content corresponding to the loaded content cannot be loaded normally.
[0076] Method C1: Detect whether the resource content corresponding to the loaded content contains the keyword.
[0077] The keyword is used to indicate that there is an error in loading the resource content.
[0078] If the resource content corresponding to the loaded content contains some pre-set keywords, such as error, cannot be displayed, error, etc., it means that the resource content called is incorrect. At this time, it can be determined that the resource content corresponding to the loaded content cannot be loaded normally in the browser page.
[0079] Method C2: Detect whether feedback information from the server corresponding to the loaded content is not received.
[0080] When no feedback is received from the server corresponding to the loaded content, it means that the browser needs to load the corresponding content, but the server has not fed the content back to the browser. At this time, the browser does not have the resource content corresponding to the loaded content, and therefore cannot display the loaded content. This can also be used to determine that the resource content corresponding to the loaded content cannot be loaded normally on the browser page.
[0081] When receiving feedback from the server corresponding to the loaded content, it is necessary to determine whether the above-mentioned keywords are present in the feedback. If the above-mentioned keywords are not present, it indicates that the feedback is correct and the loaded content can be displayed normally on the browser page. If the above-mentioned keywords are present, it indicates that an error occurred during the feedback acquisition process and the loaded content cannot be displayed normally on the browser page.
[0082] Step S303: Analyze whether the node corresponding to the loaded content complies with the detection rules.
[0083] Among them, the detection rules are preset with information corresponding to various abnormal nodes.
[0084] When the loaded content doesn't belong to a resource node, it means the content displayed by that node can be loaded directly from the browser. At this point, we can analyze whether the node corresponding to the loaded content meets the detection rules, which are preset with information corresponding to various abnormal nodes. This way, we can determine whether the content in the non-resource node can be displayed normally on the browser page.
[0085] In actual applications, a Hypertext Markup Language (HTML) checker or a JavaScript checker may be used to detect the content corresponding to the non-resource node, and the specific type of the HTML checker or the JavaScript checker is not limited here.
[0086] Specifically, the following five methods may be used, but are not limited to, to detect whether the loaded content in the non-resource node can be normally displayed on the browser page.
[0087] Method D1: Analyze whether the type corresponding to the loaded content is within the unadaptable range.
[0088] In the detection rules, you can list all types of content that are incompatible with the browser. After obtaining the loaded content on the browser page, you can compare the type of the loaded content with the type set in the detection rules. If the type of the loaded content successfully compares with one of the types set in the detection rules, it is determined that the loaded content cannot be displayed normally on the browser page. If the type of the loaded content successfully compares with all the types set in the detection rules, it is determined that the loaded content can be displayed normally on the browser page.
[0089] For example, suppose the loaded content is an image, and the detection rules include PNG, TIFF, and other types. After analysis, the loaded image type is PNG, which matches the PNG type specified in the detection rules. Therefore, it can be assumed that the image cannot be loaded and displayed properly on the browser page. This is because the image types specified in the detection rules are all known to be unavailable for loading and display on the browser page.
[0090] In actual applications, the type of the loaded content can be any type of web page object, which depends on the specific content of the loaded content. The specific content of the above types is not limited here.
[0091] Method D2: Analyze whether the attribute corresponding to the loaded content does not exist.
[0092] In the detection rules, you can set a rule for content attribute non-existence. After obtaining the loaded content on the browser page, you can determine whether the attributes of the loaded content exist based on the detection rules. If the attributes of the loaded content are found to be non-existent, it is determined that the loaded content cannot be displayed normally on the browser page. If the attributes of the loaded content are found to be present, it is determined that the loaded content can be displayed normally on the browser page.
[0093] In practical applications, the attribute of the loaded content can be any attribute of the web page object. The specific content of the attribute is not limited here.
[0094] Method D3: Analyze whether the method corresponding to the loaded content does not exist.
[0095] In the detection rules, you can set a rule for "content method does not exist." After obtaining the loaded content on the browser page, you can determine whether the method for loading the content exists based on the detection rules. If the method for loading the content does not exist, it is determined that the loaded content cannot be displayed normally on the browser page. If the method for loading the content does exist, it is determined that the loaded content can be displayed normally on the browser page.
[0096] In practical applications, the method for loading content can be any method in the web page object. The specific content of the method is not limited here.
[0097] Method D4: After calling the method corresponding to the loaded content or modifying the value corresponding to the loaded content, analyze whether the result of the call or modification does not meet expectations.
[0098] In the detection rules, you can set up some situations that do not meet expectations after calling methods or modifying object values. After obtaining the loaded content in the browser page, you can call the method corresponding to the loaded content or modify the value corresponding to the loaded content, and then compare the result after the call or the result after the value modification with the various situations that do not meet expectations set in the detection rules. If it is found that the above result is consistent with any of the above situations, it is determined that the loaded content cannot be displayed normally on the browser page. If it is found that the above result is inconsistent with none of the above situations, it is determined that the loaded content can be displayed normally on the browser page.
[0099] In actual applications, the value corresponding to the loaded content can be modified to any reasonable value. The specific size of the modified value is not limited here.
[0100] Method D5: After using a global method to operate on the loaded content, analyze whether the result of the operation does not meet expectations.
[0101] In the detection rules, you can set various situations where operations on web page objects using global methods do not meet expectations. After obtaining the loaded content on the browser page, you can use global methods to operate on the loaded content, and then compare the results of the operations with the various situations that do not meet expectations set in the detection rules. If the above result is found to be consistent with any of the above situations, it is determined that the loaded content cannot be displayed normally on the browser page. If the above result is found to be inconsistent with any of the above situations, it is determined that the loaded content can be displayed normally on the browser page.
[0102] In practical applications, the global method used can be any global method in the web page object. The specific content of the global method is not limited here.
[0103] From the above, we can see that by analyzing whether the loaded content belongs to a resource node, and then, if the loaded content belongs to a resource node, detecting whether the resource content corresponding to the loaded content cannot be loaded normally, and if the loaded content does not belong to a resource node, analyzing whether the node corresponding to the loaded content meets the detection rules, it is possible to use different methods to analyze the loaded content in different types of nodes, thereby improving the accuracy of website adaptation problem detection. In addition, in resource nodes, two different methods are divided to determine whether there is a problem with the resource content corresponding to the loaded content, and in non-resource nodes, multiple judgment rules are refined to determine whether the loaded content can be loaded normally on the browser page. These can more comprehensively determine whether the loaded content will be displayed normally on the browser page, thereby improving the accuracy of website adaptation detection.
[0104] Furthermore, for websites that have already been launched, if adaptation issues are discovered, in order to avoid affecting users' use of the website's functional modules, it is possible to modify the website's browser code first, rather than modifying the source code on the website's server. Once it is confirmed that the website's content can be loaded and displayed normally on the browser page, similar modifications can be made to the corresponding portion of the website's server source code. This can shorten the maintenance time of the website server and improve the user experience of the website.
[0105] If the website is debugged in the above manner, the above step S103 needs to be adaptively changed to: obtaining a web page code snippet for loading content in the browser.
[0106] Figure 4 This is a flow chart of the website debugging process in the embodiment of this application, see Figure 4 As shown, after step S103, the following steps may also be included:
[0107] S401: Debugging a webpage code snippet of content loaded into a browser.
[0108] After obtaining a problematic webpage code snippet from the website content loaded by the browser, the problematic webpage code snippet can be debugged in the browser, i.e., the problematic webpage code snippet can be modified so that the corresponding content can be displayed on the browser page. The specific debugging method can adopt various existing mature debugging solutions. The specific debugging method is not limited here.
[0109] S402: Determine whether the loaded content after debugging can be loaded normally in the browser page; if so, execute step S403; if not, return to step S401.
[0110] S403: Send the debugged content to the website server corresponding to the loaded content.
[0111] That is to say, when debugging makes the loaded content load normally in the browser's page, it means that the debugging solution is adopted to make the loaded content load and display normally in the browser's page. Then, the debugged content is sent to the website server corresponding to the loaded content, and in the website server, the source code at the corresponding position can be directly modified according to the debugged content. In this way, the time spent on manually searching for the corresponding fragment of the source code in the website server according to the adaptation problem can be saved, and the time for modifying the source code in the website server and verifying it can be saved, thereby improving the efficiency of solving the website adaptation problem. When debugging still makes the loaded content unable to load normally in the browser's page, the web page code fragment corresponding to the loaded content in the browser is debugged again until debugging makes the loaded content still unable to load normally in the browser's page, and then continue to perform the above-mentioned step S403.
[0112] As can be seen from the above content, when it is determined that the loaded content cannot be loaded and displayed normally in the browser page, the web page code snippet of the loaded content in the browser is debugged, and the debugged web page code snippet is sent to the website's server. Compared with directly debugging and modifying the source code in the website server, or modifying the source code through the website's test environment (the test environment of some old websites does not even exist anymore), debugging and modifying the website's code in the browser can save the time spent on manually finding the corresponding source code snippet in the website server based on the adaptation problem, and save the time of modifying the source code in the website server and verifying it, thereby improving the efficiency of solving website adaptation problems.
[0113] Finally, a complete description is given again of the website adaptation problem detection method provided in the embodiment of the present application.
[0114] Figure 5 This is a flow chart of the website adaptation problem detection method in the embodiment of this application. Figure 2 , see Figure 5 As shown, the method may include:
[0115] S501: Start detection.
[0116] S502: Reload the page in the browser and inject the JS browser extension.
[0117] S503: Traverse the node tree in the page.
[0118] S504: Determine whether the current node is a Uniform Resource Locator (URL) node; if so, execute S505; if not, execute S506.
[0119] S505: Check whether there is a problem with the resource content; if so, execute S507; if not, continue to execute S503.
[0120] S506: Check whether there is a problem with the node; if so, execute S507; if not, continue to execute S503.
[0121] S507: Generate detection results.
[0122] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application further provides a website adaptation problem detection device, which is applied in a browser. Figure 6 This is a schematic diagram of the structure of the website adaptation problem detection device in the embodiment of the present application. Figure 1 , see Figure 6 As shown, the device may include:
[0123] The acquisition module 601 is used to obtain the content loaded by the browser in the page.
[0124] The analysis module 602 is used to analyze whether the loaded content complies with preset rules, where the preset rules are a set of situations in which the corresponding content cannot be loaded in the browser page.
[0125] The interception module 603 is configured to obtain a webpage code segment corresponding to the loaded content and record the webpage code segment as a problem code.
[0126] Furthermore, as a Figure 6 As a refinement and extension of the device shown, an embodiment of the present application further provides a device for detecting website adaptation problems. Figure 7 This is a schematic diagram of the structure of the website adaptation problem detection device in the embodiment of the present application. Figure 2 , see Figure 7 As shown, the device may include:
[0127] The generation module 701 includes:
[0128] The determining unit 7011 is configured to obtain the programming language supported by the browser.
[0129] The editing unit 7012 is used to generate a browser plug-in using the programming language, and the browser plug-in is used to perform adaptation detection on the website loaded in the browser.
[0130] The loading unit 7013 is used to load the browser plug-in into the browser.
[0131] The loading unit 7013 is specifically configured to automatically load the browser plug-in into the browser when the browser is installed in the test terminal and the test terminal is successfully connected to the network.
[0132] When the browser plug-in is generated using the JS language, the judgment module 702 includes:
[0133] The first determining unit 7021 is configured to determine whether the browser supports the JS language.
[0134] The policy unit 7022 is configured to, if not, send a request to the server to which the browser belongs through the browser plug-in to obtain the loaded content, and obtain the loaded content of the browser in the page from the response information of the server to which the browser belongs.
[0135] The acquisition module 703 is specifically configured to, if yes, obtain the content loaded by the browser in the page through the browser plug-in.
[0136] The analysis module 704 includes:
[0137] The second judging unit 7041 is configured to judge whether the loaded content is a resource node.
[0138] The first execution unit 7042 is configured to detect whether the resource content corresponding to the loaded content cannot be loaded normally.
[0139] The first execution unit 7042 is specifically used to: detect whether the resource content corresponding to the loaded content contains a keyword, where the keyword is used to indicate that there is an error in the loading of the resource content; or detect whether feedback information from the server corresponding to the loaded content is not received.
[0140] The second execution unit 7043 is configured to analyze whether the node corresponding to the loaded content complies with a detection rule if no, wherein the detection rule is preset with information corresponding to various abnormal nodes.
[0141] The second execution unit 7043 is specifically used to: analyze whether the type corresponding to the loaded content is within the non-adaptable range; or, analyze whether the attribute corresponding to the loaded content does not exist; or, analyze whether the device corresponding to the loaded content does not exist; or, after calling the device corresponding to the loaded content or modifying the value corresponding to the loaded content, analyze whether the result of the call or modification does not meet expectations; or, after using a global device to operate the loaded content, analyze whether the result of the operation does not meet expectations.
[0142] The interception module 705 is configured to obtain the webpage code fragment of the loaded content in the browser if yes, and record the webpage code fragment as the problem code.
[0143] The debugging module 706 includes:
[0144] The debugging unit 7061 is used to debug the web page code fragment of the loaded content in the browser.
[0145] The sending unit 7062 is configured to send the debugged content to the website server corresponding to the loaded content when the loaded content can be normally loaded in the browser page through debugging.
[0146] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0147] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.
[0148] It should be noted that the description of the above storage medium embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the storage medium embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0149] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for detecting website adaptation problems, characterized in that: The method is applied in a browser and includes: Obtaining the content loaded by the browser in the page; Analyzing whether the loaded content complies with preset rules, where the preset rules are a set of situations in which corresponding content cannot be loaded in the browser page, and the set of situations is generated based on attributes or related features of the content that the browser does not support loading; If so, obtaining a webpage code snippet corresponding to the loaded content, and recording the webpage code snippet as a problem code; The analyzing whether the loaded content complies with preset rules includes: Determine whether the loaded content is a resource node; If not, then analyzing whether the node corresponding to the loaded content complies with the detection rules, wherein the detection rules are preset with information corresponding to various abnormal nodes; The step of analyzing whether the node corresponding to the loaded content complies with the detection rules includes: Analyze whether the attribute corresponding to the loaded content does not exist; or, Analyze whether the method corresponding to the loaded content does not exist; or, After calling the method corresponding to the loaded content or modifying the value corresponding to the loaded content, analyzing whether the result of the call or modification does not meet expectations; or, After operating the loaded content using a global method, analyze whether the result of the operation does not meet expectations.
2. The method according to claim 1, characterized in that Before obtaining the content loaded by the browser in the page, the method further includes: Obtaining programming languages supported by the browser; Generating a browser plug-in using the programming language, wherein the browser plug-in is used to perform adaptation detection on the website loaded in the browser; Loading the browser plug-in into the browser; The obtaining of the content loaded by the browser in the page includes: The browser's loaded content in the page is obtained through the browser plug-in.
3. The method according to claim 2, characterized in that The browser plug-in is generated using the JS language; before obtaining the loaded content of the browser in the page through the browser plug-in, the method further includes: Determine whether the browser supports JS language; If yes, then executing the step of obtaining the content loaded by the browser in the page through the browser plug-in; If not, a request for obtaining the loaded content is sent to the server to which the browser belongs through the browser plug-in, and the loaded content of the browser in the page is obtained from the response information of the server to which the browser belongs.
4. The method according to claim 2, characterized in that The step of loading the browser plug-in into the browser comprises: When the browser is installed in the test terminal and the test terminal is successfully connected to the network, the browser plug-in is automatically loaded into the browser.
5. The method according to claim 1, wherein The obtaining of the webpage code snippet corresponding to the loaded content includes: Obtaining a webpage code snippet of the loaded content in the browser; After obtaining the webpage code snippet corresponding to the loaded content, the method further includes: Debugging the webpage code snippet of the loaded content in the browser; When the loaded content can be normally loaded in the page of the browser through debugging, the debugged content is sent to the website server corresponding to the loaded content.
6. The method according to any one of claims 1 to 5, characterized in that The analyzing whether the loaded content complies with preset rules includes: Determine whether the loaded content is a resource node; If so, it is detected whether the resource content corresponding to the loaded content cannot be loaded normally.
7. The method according to claim 6, characterized in that The analyzing whether the node corresponding to the loaded content complies with the detection rule includes: Analyze whether the type corresponding to the loaded content is within an unadaptable range.
8. The method according to claim 6, characterized in that The detecting whether the resource content corresponding to the loaded content cannot be loaded normally includes: Detecting whether the resource content corresponding to the loaded content contains a keyword, wherein the keyword is used to indicate that an error exists in the loading of the resource content; or Detect whether feedback information from the server corresponding to the loaded content is not received.
9. A website adaptation problem detection device, characterized in that: The device is applied in a browser and includes: A collection module, used to obtain the content loaded by the browser in the page; An analysis module, configured to analyze whether the loaded content complies with a preset rule, wherein the preset rule is a set of situations in which the corresponding content cannot be loaded in the browser page, and the set of situations is generated based on attributes or related features of the content that the browser does not support loading; an interception module, configured to, if yes, obtain a webpage code fragment corresponding to the loaded content, and record the webpage code fragment as a problem code; The analysis module includes: A second judging unit, configured to judge whether the loaded content is a resource node; The second execution unit is configured to analyze whether the node corresponding to the loaded content complies with a detection rule if no, wherein the detection rule is preset with information corresponding to various abnormal nodes; The second execution unit is specifically used to: analyze whether the attribute corresponding to the loaded content does not exist; or, analyze whether the device corresponding to the loaded content does not exist; or, after calling the device corresponding to the loaded content or modifying the value corresponding to the loaded content, analyze whether the result of the call or modification does not meet expectations; or, after using a global device to operate the loaded content, analyze whether the result of the operation does not meet expectations.
10. A computer-readable storage medium, characterized in that include: A stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Data loading method and device in mobile terminal
CN106502738A
Restoring method of abnormal webpage based on IPTV browser, medium and equipment
CN107957947A
Fault solving method, server and mobile terminal
CN108121642A
Problem code positioning method and device
CN111026637A