CN115470127B - Page compatibility processing method, device, computer equipment and storage medium - Google Patents

Page compatibility processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN115470127B
CN115470127B CN202211084625.1A CN202211084625A CN115470127B CN 115470127 B CN115470127 B CN 115470127B CN 202211084625 A CN202211084625 A CN 202211084625A CN 115470127 B CN115470127 B CN 115470127B
Authority
CN
China
Prior art keywords
page
identification information
current
current page
source file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211084625.1A
Other languages
Chinese (zh)
Other versions
CN115470127A (en
Inventor
张昊
安晓江
胡伯良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Haitai Fangyuan High Technology Co Ltd
Original Assignee
Beijing Haitai Fangyuan High Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Haitai Fangyuan High Technology Co Ltd filed Critical Beijing Haitai Fangyuan High Technology Co Ltd
Priority to CN202211084625.1A priority Critical patent/CN115470127B/en
Publication of CN115470127A publication Critical patent/CN115470127A/en
Application granted granted Critical
Publication of CN115470127B publication Critical patent/CN115470127B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

The embodiment of the application provides a page compatibility processing method, a page compatibility processing device, computer equipment and a storage medium, and relates to the field of computers. According to the page compatibility processing method, the source file of the current page in the current browser is obtained, the source file is analyzed to obtain the identification information, if the identification information is not matched with the preset identification information, the incompatibility of the current page and the browser is determined, the target configuration information of the current page is found, and therefore the problem that the timeliness of the browser compatibility test is poor is solved, and the technical effect of improving the timeliness of the browser compatibility test is achieved.

Description

Page compatibility processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for processing page compatibility, a computer device, and a storage medium.
Background
Browser compatibility is a problem that different display effects of pages appear in different browsers, which is also one of important factors affecting user experience, so that the browser can perform compatibility test before being online. At present, a browser screenshot is mainly adopted as a mode for testing the compatibility of the browser, namely, a screenshot tool is used for intercepting display pictures of the same page on different browsers, then, different display pictures are compared, and the compatibility of the page executed on different browsers is determined according to a comparison result.
Once the page is found to be incompatible on some browsers, the reasons for the incompatibility are mainly screened out by staff at present, and the reasons are further repaired, and in actual work, different nodes are generally responsible for different staff, and the time required from the detection of the incompatibility problem to the repair completion is generally longer.
Therefore, the current browser compatibility test is less time-efficient.
Disclosure of Invention
In order to solve the technical problems, the embodiment of the application provides a page compatibility processing method, a device, computer equipment and a storage medium.
In a first aspect of the embodiment of the present application, there is provided a page compatibility processing method, including:
acquiring a source file of a current page in a current browser, wherein a document object model file of the current page is stored in the source file;
analyzing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser;
if the identification information is not matched with the preset identification information of the current page, inquiring from a pre-stored configuration file to obtain target configuration information corresponding to the identification information;
and modifying the identification information of the current page based on the target configuration information so as to adapt the current page to the current browser.
In an alternative embodiment of the application, the identification information in the method comprises: at least one of tag type, syntax format, and attribute information.
In an optional embodiment of the present application, in the method, the parsing the source file to obtain a plurality of identification information corresponding to the current page includes:
analyzing the source file of the current page to obtain the page tag corresponding to the current page;
and extracting information in each page tag aiming at each page tag to obtain each piece of identification information corresponding to each page tag.
In an optional embodiment of the application, after the obtaining the plurality of identification information corresponding to the current page in the current browser, the method further includes:
content comparison is carried out on each piece of identification information and each piece of preset identification information in a compatibility information list of the current browser;
and determining whether the identification information is matched with the preset identification information of the current page according to the comparison result.
In an alternative embodiment of the present application, the modifying the identification information of the current page based on the target configuration information in the method includes:
injecting the target configuration information into a source file of the current page based on an injection script in an expansion module to obtain an updated source file;
based on the updated source file, a plurality of the identification information in the current page is updated.
In an alternative embodiment of the application, the method further comprises:
and storing the updated source file in a target position corresponding to the current page in a local storage module.
In an alternative embodiment of the present application, the updated source file includes at least: the page tag of the current page, the identification information and the target configuration file.
In an alternative embodiment of the application, the method further comprises:
retrieving the updated source file from the local storage module in response to a reload operation of the current browser for the current page;
and taking the updated source file as the source file of the current page in the current browser, and loading the current page.
In a second aspect of the embodiment of the present application, there is provided a page compatibility processing apparatus, including: an acquisition module, an analysis module, a query module and a modification module,
the acquisition module is used for acquiring a source file of a current page in a current browser, wherein the source file stores a document object model file of the current page;
the analyzing module is used for analyzing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser;
the query module is used for querying from a pre-stored configuration file to obtain target configuration information corresponding to the identification information if the identification information is not matched with the preset identification information of the current page;
the modification module is used for modifying the identification information of the current page based on the target configuration information so as to adapt the current page to the current browser.
In a third aspect of the embodiment of the present application, there is provided a computer apparatus including: comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
In a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any of the above.
According to the method provided by the embodiment of the application, the source file of the current page is obtained, the identification information in the source file is analyzed, and if the identification information in the source file is not matched with the preset identification information, the current page is determined to be incompatible with the browser, so that whether the current page is compatible with the browser or not can be judged in a code layer, one-to-one manual screening by staff is not needed, the efficiency is higher, judgment after the browser finishes loading page data is avoided, the timeliness is higher, the problem that the timeliness of the existing browser compatibility test is poor is solved, and the technical effect of improving the timeliness of the browser compatibility test is achieved.
Meanwhile, the embodiment of the application automatically acquires the target configuration information matched with the current page under the condition that the current page is incompatible with the browser, and automatically modifies the unmatched identification information in the current page in real time based on the target configuration information, thereby improving the compatibility of the browser to the current page.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a schematic view of an application scenario of a page method according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for processing page compatibility according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for processing page compatibility according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for processing page compatibility according to an embodiment of the present application;
FIG. 5 is a flowchart of a method for processing page compatibility according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for processing page compatibility according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a page compatibility processing device according to an embodiment of the present application 1;
FIG. 8 is a schematic diagram of a page compatibility processing device according to an embodiment of the present application 2;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In the process of implementing the application, the inventor finds that the current browser compatibility test has poor timeliness.
In view of the above problems, embodiments of the present application provide a method, an apparatus, a computer device, and a storage medium for processing page compatibility.
The scheme in the embodiment of the application can be realized by adopting various computer languages, such as object-oriented programming language Java, an transliteration script language JavaScript and the like.
In order to make the technical solutions and advantages of the embodiments of the present application more apparent, the following detailed description of exemplary embodiments of the present application is provided in conjunction with the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present application and not exhaustive of all embodiments. It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other.
In the process of using the browser, the user cannot be compatible with the page requested by the user because of the browser, for example, different browser use kernels and supported page language standards such as HTML, or different environments of the user client, and finally the display effect cannot achieve the ideal effect. In order to detect the compatibility of the browser, the prior art uses a screenshot tool to intercept the pictures of the same page loaded by different browsers for comparison after the browser loads the page, and outputs the comparison result; or the open source frame and the browser drive are used for loading the page, and the results of loading the page by different browsers are compared, but in the analysis and comparison process, the data of the target page is loaded by the browser, and then the compatibility of the browser is judged according to the loading result, so that the processing resource of the browser can be wasted in the data loading process, the configuration of the browser can not be adjusted in real time according to the loading process, and finally the problem of poor timeliness of the compatibility test of the browser is caused.
Based on the fact that the timeliness of the browser compatibility test in the prior art is poor, the application provides a page processing method, which comprises the steps of obtaining a source code of a current page, judging whether elements which are incompatible with a browser are contained in the code by analyzing the current page code, and if the current page contains the elements which are incompatible with the browser, modifying the source code of the current page according to a preset configuration file, so that the browser compatibility is judged in the page loading process, and the incompatible code can be dynamically modified.
The following briefly describes an application environment of the page compatibility processing method provided by the embodiment of the present application:
referring to fig. 1, a terminal device 10 provided in the embodiment of the present application may be a service terminal, for example, a server cluster, or a local terminal, for example, a computer, a personal notebook, a tablet computer, or a wearable device, which is not meant to be exhaustive. The terminal equipment is configured with at least one browser, and the browser can load a network page when running, and the network page is used as a test page of the embodiment of the application. It should be explained that the browser is configured with an engine module, a storage module and an expansion module; the engine module in the browser is used for acquiring a source file of a current page, analyzing the source file and acquiring identification information of the current page; acquiring preset identification information of the current page through a storage module, comparing the identification information of the current page with the preset identification information, if the identification information is not matched with the preset identification information, acquiring target configuration information matched with the identification information through an expansion module, and modifying a source file through the target configuration information; the expansion module in the browser is used for reading the target configuration file of the current page in the storage and storage module, updating the source file of the current page, and injecting the updated source file into the page when the current page is accessed so as to realize compatibility adaptation of the page to the browser, wherein the target configuration file is generated according to the compatibility regulation of the browser; the storage module in the browser is used for storing preset identification information corresponding to the source file of the current page and the target configuration file of the current page.
Referring to fig. 2, the following embodiments take the above terminal device as an execution body, and exemplify that a web page is compatible with any browser in the terminal device. The page compatibility processing method provided by the embodiment of the application comprises the following steps 201 to 204:
step 201, obtaining a source file of a current page in a current browser.
The source file refers to a file storing basic codes and configuration information of a current page, a document object model file of the current page is stored in the source file, and the source file at least comprises a document object model (Document Object Model, abbreviated as DOM) of the current page.
The current page may be a test web page or any page when the browser runs, and the embodiment of the present application is not specifically limited, and the basic code in the source file of the current page generally includes: HTML documents are composed of various HTML elements such as an HTML element (HTML document root element), a head element, a body element, a title element, and a p element. Meanwhile, based on the objects in the current page source file code, the structure and the content of the HTML document are converted into object models, namely DOMs, which can be used by various programs. A document object model (Document Object Model, DOM for short), the DOM provides an access model to the entire page file, by employing a tree structure to represent each element in the page, each node of the tree representing an HTML tag or text item within the tag. The embodiment of the application can acquire or call the source file of the current page from the expansion module in the current browser.
Step 202, analyzing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser.
The identification information of the current page is used for distinguishing each element of the current page, and at least comprises the following components: at least one of tag type, syntax format, description information, attribute information of the current page, wherein the attribute information may include an attribute name and an attribute value, for example, an ID attribute of the target element, and the ID attribute information includes an attribute name: an element A; attribute value: n.
In the embodiment of the application, the DOM file of the source file in the current page is analyzed, a structure formed by multiple layers of nodes in the HTML document is obtained, wherein the nodes are divided into different types, such as document nodes, element nodes, attribute nodes, text nodes and annotation nodes, each type of nodes respectively represents different information or marks in the document, and the identification information of the current page is obtained through the node types, the node values and the node names contained in the nodes.
Step 203, if the identification information is not matched with the preset identification information of the current page, inquiring from a pre-stored configuration file to obtain target configuration information corresponding to the identification information.
The preset identification information is a monitoring index for compatibility adaptation by a developer according to actual needs, wherein the monitoring index is part of identification information selected from a plurality of pieces of identification information conforming to browser compatibility rules. For example, in order to detect compatibility of the browser with respect to audio playing in the page, identification information related to audio in the browser may be selected as preset identification information, i.e. a monitoring index.
The comparison and judgment of the identification information of the current page and the preset identification information can be used for judging whether the current page is compatible with the browser, and the preset identification information can be a page tag or other tag information. The page tag preset for the current page describes preset elements of the current page.
The target configuration information in the embodiment of the application can be obtained according to the configuration information of the current page in the history record, and also can be obtained according to preset page configuration information.
After the identification information is determined to be not matched with the preset identification information of the current page, finding out which specific identification information of the current page is not matched with the preset identification information, for example, sequentially comparing at least one of the tag type, the grammar format, the description information and the attribute information of the current page, and if any information is not matched with the preset information, querying target configuration information corresponding to the identification information from a pre-stored configuration file.
For example, comparing and analyzing according to the tag type, if the identification information indicates that the tag type is a video tag, determining a video format played by the current page according to the video tag; meanwhile, a preset video tag in preset identification information is found, a browser supported video format is determined according to the preset video tag, if the video format supported by the browser is not matched with the video format played by the current page, target configuration information corresponding to the identification information is queried from a pre-stored configuration file, and the problem that the browser is not compatible with the page video format is solved.
And 204, modifying the identification information of the current page based on the target configuration information so as to adapt the current page to the current browser.
And modifying the identification information of the current page based on the target configuration information so that all information in the labels, language rules and attributes of the current page in the identification information accords with preset identification information, namely, the current page meets the compatibility regulation of the browser.
In the embodiment of the application, the target configuration information can be injected into the page through the browser extension module when the current page is accessed so as to realize compatibility adaptation of the page to the browser, wherein the extension module is pre-configured with a code injection program which can be used for injecting the target configuration information when the current page is accessed so as to realize the technical effect of modifying the source file of the current page.
And after the identification information of the current page is modified, judging again until the identification information is determined to be matched with the preset identification information of the current page, and marking the current page as a page matched with the browser.
According to the method provided by the embodiment of the application, the source file of the current page is obtained, the identification information in the source file is analyzed, and if the identification information in the source file is not matched with the preset identification information, the current page is determined to be incompatible with the browser, so that whether the current page is compatible with the browser or not can be judged in a code layer, one-to-one manual screening by staff is not needed, the efficiency is higher, judgment after the browser finishes loading page data is avoided, the timeliness is higher, the problem that the timeliness of the existing browser compatibility test is poor is solved, and the technical effect of improving the timeliness of the browser compatibility test is achieved.
Meanwhile, the embodiment of the application automatically acquires the target configuration information matched with the current page under the condition that the current page is incompatible with the browser, and automatically modifies the unmatched identification information in the current page in real time based on the target configuration information, thereby improving the compatibility of the browser to the current page.
In an alternative embodiment of the present application, the identification information in the method provided by the present application includes: at least one of tag type, syntax format, and attribute information.
The page tags may include various types of tags, such as < html >/< html > in the base tag, < b >/< b > in the common format tag, < form > in the form tag, < menu > in the list tag, < img > in the application tag, and < video > in the video tag, with different tags representing different page elements and not being discussed in detail herein.
The grammar format is set according to the description of the elements of different types, and if the grammar format corresponding to the description of the content type of the elements is: the extension name is html or html, and the corresponding content type is text/html.
Attribute information is used to identify elements in the page, such as class attributes of the elements, and is used to define class rules or style rules; or, an ID attribute of the element, defining a unique identification of the element.
The identification information acquired by the method provided by the application when analyzing the source file of the current page comprises information of various elements, so that the information is richer when judging the compatibility based on the identification information, the comparison result is more accurate, and the reliability of the compatibility test and the adaptation repair in the embodiment of the application is further improved.
As shown in fig. 3, in an alternative embodiment of the present application, the step 202 parses the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser, and further includes the following steps 301-302:
step 301, analyzing a source file of a current page, and obtaining a plurality of page tags corresponding to the current page.
The DOM file contained in the source file of the current page represents the page element in the form of a node tree, the content in the tree is called as a node, and the node acquires element nodes (labels), attribute nodes and text nodes, so that the label information of the element can be acquired through the element nodes. After the source file of the current page is analyzed, a page tag corresponding to the current page is obtained through a traversal algorithm, for example, the source code of the current page is traversed through a depth-first traversal algorithm. Through the depth-first traversal algorithm, nodes are not reserved in the searching process, so that the technical effect of small occupied space can be achieved, related objects can be arranged together, the hit of a cache is increased, and the operation speed is improved.
Step 302, for each page tag, extracting information in the page tag to obtain each piece of identification information corresponding to each page tag.
The element in the current page can be described through the page tag, the element attribute and grammar information of the element can be searched through the element in the current page, and finally the identification information of the current page is generated according to the page tag, grammar and attribute information of the element of the current page.
The application can extract the identification information of the current page by analyzing the type and the number of the types of the tags of the current page, thereby judging the compatibility of the current page and the browser based on the element information in various tags, improving the reliability when judging the compatibility of the page, and being convenient for realizing the follow-up improvement of the timeliness of the compatibility judgment.
As shown in fig. 4, in an alternative embodiment of the present application, after parsing the source file in the step 202 to obtain a plurality of pieces of identification information corresponding to the current page in the current browser, the method further includes the following steps 401-402:
and 401, respectively comparing the identification information with each preset identification information in a compatibility information list of the current browser.
The compatibility information list of the current browser is used for indicating preset identification information corresponding to a test item in the compatibility test of the current browser, for example, the test item may include: play compatibility test or object program compatibility test, etc. The compatibility information list at least comprises at least one of tag type, grammar format and attribute information in preset identification information. The description of the preset identification information is shown in step 203, and will not be repeated here.
When content comparison is performed, each type of information in the preset identification information of the current item in the compatibility list can be compared with the preset identification information of the current page in sequence, and after the comparison of all types of information in the preset identification information of the current item is completed, each type of information in the preset identification information of the next item is compared.
Or, the target type information in the preset identification information of the current item in the compatibility list can be compared with the target type information in the preset identification information of the current page, and after the target type information in the preset identification information of the current item is compared, the target type information in the preset identification information of the next item is compared.
Step 402, determining whether the identification information is matched with the preset identification information of the current page according to the comparison result.
If at least one of the tag type, the grammar format and the attribute information in the identification information is not matched with the preset identification information, determining that the identification information is not matched with the preset identification information of the current page.
For example, taking attribute information in the comparison identification information as an example, how to compare the identification information with preset identification information is described: acquiring a target attribute name and a target attribute value of the current page according to the identification information; searching a preset attribute value in preset identification information of the current page according to the target attribute name; if the target attribute value is not matched with the preset attribute value, determining that the identification information is not matched with the preset identification information of the current page.
In the embodiment of the application, whether the identification information of the current page is matched with the preset identification information is judged by comparing the identification information of the current page with each preset identification information in the compatibility information list, elements which are possibly incompatible with the browser and are contained in the code of the current page, such as the attribute of the elements or the grammar of the elements, are screened out, the browser compatibility judgment is replaced by comparing the elements in the code layer one by one through the comparison of the page pictures in the prior art, the accuracy in judging the browser compatibility is improved, meanwhile, the incompatible elements in the current page are conveniently and accurately positioned, the accuracy of the compatibility restoration of the current page is improved, and finally the compatibility of the current page in the browser is improved.
As shown in fig. 5, in an alternative embodiment of the present application, the modification of the identification information of the current page based on the target configuration information in the step 204 to adapt the current page to the current browser includes the following steps 501-502:
step 501, injecting target configuration information into a source file of a current page based on an injection script in an expansion module to obtain an updated source file.
The target configuration file is a configuration file for modifying the identification information corresponding to the current page, so that the identification information of the current page meets the identification information of the preset page, namely, the current page meets the browser compatibility rule.
The target configuration file comprises a pre-configured modification scheme in the browser expansion module, and can also comprise a modification code generated by operation and maintenance personnel according to incompatible identification information in the current page.
And when the access to the current page is detected, the updated target configuration file is injected into the source file of the current page through the injection script in the expansion module.
Step 502, updating the identification information of the current page based on the updated source file.
After the configuration information of the current page is modified, an expansion module in the browser updates the target configuration file according to the page address, the tag position and the specific modified configuration file of the current modification, and updates the source file according to the page tag of the current page, the identification information and the updated target configuration file.
Updating the identification information of the current page based on the modified source file so that the identification information of the current page is matched with the preset identification information, namely, the current page is matched with the browser.
According to the embodiment of the application, the target configuration information is injected into the source file of the current page based on the injection script in the expansion module, so that the method is simple and convenient, the effect is higher, the efficiency of updating the identification information of the current page based on the updated source file is improved, and the efficiency of compatibility restoration of the embodiment of the application is further improved. In an alternative embodiment of the present application, the updated source file in the method provided by the present application includes at least: page tags, identification information and target configuration files of the current page; the page tag and the identification information of the current page refer to the page tag and the identification information of the current page after being modified according to the target configuration file; the target configuration information refers to a configuration file corresponding to the current page modification process. The updated source file at least comprises the page tag of the current page, the identification information and the target configuration file, so that the corresponding source file can be conveniently and efficiently found in the next call, the call efficiency of the target configuration file is improved, and the compatibility restoration efficiency of the embodiment of the application is further improved.
In an optional embodiment of the present application, after modifying the identification information of the current page, the method provided by the present application further includes: and storing the modified source file in a current page in a local storage module.
According to the embodiment of the application, the modified source file corresponding to the current page is stored in the local storage module, so that the source file of the current page can be conveniently and rapidly searched when the current page is loaded later, and the configuration information of the current page is modified through the source file, so that the durability of compatibility adaptation of the current page is improved. As shown in fig. 6, in an alternative embodiment of the present application, after modifying the identification information of the current page based on the target configuration information in the step 204, the method includes the following steps 601-602:
step 601, responding to reloading operation of the current browser on the current page, and calling the updated source file from the local storage module.
The local side storage module stores the modified source file in a target position corresponding to the current page in the local side storage module, and when the reloading operation is responded, the source file is called in the target position.
The updated source file comprises a page tag of the current page, identification information and an updated target configuration file.
Step 602, taking the updated source file as the source file of the current page in the current browser, and loading the current page.
And calling a target configuration file in the updated source file in the current page loading process, and updating elements incompatible with the browser in the current page to elements adaptive to the browser through the target configuration file, namely enabling the loaded webpage to be compatible with the browser.
According to the embodiment of the application, the modified source file corresponding to the current page is stored, so that the local configuration file can be read when the browser is started again, and the modification code in the configuration file is executed again when the corresponding page is loaded, thereby achieving the purposes of compatibility modification and adaptation persistence.
It should be understood that, although the steps in the flowchart are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of other steps or other steps.
Referring to fig. 7, an embodiment of the present application provides a page compatibility processing apparatus 70, where the apparatus 70 includes: an acquisition module 701, a parsing module 702, a query module 703 and a modification module 704,
the obtaining module 701 is configured to obtain a source file of a current page in a current browser, where the source file stores a document object model file of the current page;
the parsing module 702 is configured to parse the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser;
the query module 703 is configured to query from a pre-stored configuration file for target configuration information corresponding to the identification information if the identification information is not matched with the preset identification information of the current page;
the modification module 704 is configured to modify the identification information of the current page based on the target configuration information, so as to adapt the current page to the current browser.
In an alternative embodiment of the present application, the identification information obtained by the parsing module 702 in the apparatus 70 includes: at least one of tag type, syntax format, and attribute information.
In an alternative embodiment of the present application, the parsing module 702 in the apparatus 70 is further configured to:
analyzing the source file of the current page to obtain a plurality of page tags corresponding to the current page;
and extracting information in the page tags aiming at each page tag to obtain identification information corresponding to each page tag.
Referring to fig. 8, in an alternative embodiment of the present application, the apparatus 70 further includes a matching module 705, where the matching module 705 is configured to compare each piece of identification information with each piece of preset identification information in the compatibility information list of the current browser;
and determining whether the identification information is matched with the preset identification information of the current page or not according to the comparison result.
In an alternative embodiment of the application, the modification module 704 in the apparatus 70 is further configured to: modifying the identification information of the current page based on the target configuration information; comprising the following steps:
injecting the target configuration information into a source file of the current page based on an injection script in an expansion module to obtain an updated source file;
based on the updated source file, a plurality of identification information in the current page is updated.
In an alternative embodiment of the application, the modification module 704 in the apparatus 70 is further configured to:
and storing the updated source file in a target position corresponding to the current page in a local storage module.
In an alternative embodiment of the application, the modification module 704 in the apparatus 70 is further configured to:
responding to reloading operation of the current browser for the current page, and calling updated source files from a local storage module;
and taking the updated source file as the source file of the current page in the current browser, and loading the current page.
In an alternative embodiment of the present application, the updated source file in the modification module 704 in the apparatus 70 includes at least: the page tag of the current page, the identification information and the target configuration file.
According to the device provided by the embodiment of the application, the source file of the current page is obtained, the identification information in the source file is analyzed, and if the identification information in the source file is not matched with the preset identification information, the incompatibility of the current page and the browser is determined, so that whether the page is compatible with the browser or not can be judged in a code layer, the incompatibility problem that a worker screens the page is replaced, the judgment is performed after the loading of the page data by the browser is avoided, the problem that the timeliness of the compatibility test of the browser is poor is solved, and the technical effect of improving the timeliness of the compatibility test of the browser is realized.
The specific limitation of the above-mentioned page compatibility processing device may be referred to as limitation of the page compatibility processing method, and will not be described herein. The respective modules in the above-described page compatibility processing apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, the internal structure of which may be as shown in FIG. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a page compatibility processing method as described above. Comprising the following steps: the system comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes any step of the page compatibility processing method when executing the computer program.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, can implement any of the steps of the page compatibility processing method described above.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (16)

1. A page compatibility processing method, comprising:
acquiring a source file of a current page in a current browser, wherein a document object model file of the current page is stored in the source file;
analyzing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser;
if the identification information is not matched with the preset identification information of the current page, inquiring from a pre-stored configuration file to obtain target configuration information corresponding to the identification information;
modifying the identification information of the current page based on the target configuration information to adapt the current page to the current browser, including:
injecting the target configuration information into the source file of the current page based on an injection script in an expansion module to obtain an updated source file;
and updating a plurality of identification information in the current page based on the updated source file.
2. The method for processing page compatibility according to claim 1, wherein the parsing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser includes:
analyzing the source file of the current page to obtain a plurality of page tags corresponding to the current page;
and extracting information in the page tags aiming at each page tag to obtain the identification information corresponding to each page tag.
3. The page compatibility processing method according to claim 1 or 2, wherein the identification information includes: at least one of tag type, syntax format, and attribute information.
4. The page compatibility processing method according to claim 2, wherein after obtaining a plurality of pieces of identification information corresponding to the current page in the current browser, the method further comprises: content comparison is carried out on each piece of identification information and each piece of preset identification information in a compatibility information list of the current browser;
and determining whether the identification information is matched with the preset identification information of the current page or not according to the comparison result.
5. The page compatibility processing method of claim 1, further comprising:
and storing the updated source file in a local storage module.
6. The page compatibility processing method of claim 5, wherein: the updated source file at least comprises: and the page tag of the current page, the identification information and the target configuration file.
7. The page compatibility processing method of claim 5 or 6, further comprising:
retrieving the updated source file from the local storage module in response to a reload operation of the current browser for the current page;
and taking the updated source file as the source file of the current page in the current browser, and loading the current page.
8. A page compatibility processing apparatus, comprising: the system comprises an acquisition module, an analysis module, a query module and a modification module, wherein:
the acquisition module is used for acquiring a source file of a current page in a current browser, wherein the source file stores a document object model file of the current page;
the analysis module is used for analyzing the source file to obtain a plurality of pieces of identification information corresponding to the current page in the current browser;
the query module is used for querying from a pre-stored configuration file to obtain target configuration information corresponding to the identification information if the identification information is not matched with the preset identification information of the current page;
the modification module is configured to modify the identification information of the current page based on the target configuration information, so that the current page is adapted to the current browser, and includes:
injecting the target configuration information into the source file of the current page based on an injection script in an expansion module to obtain an updated source file;
and updating a plurality of identification information in the current page based on the updated source file.
9. The page compatibility processing apparatus of claim 8, wherein said parsing module is configured to,
analyzing the source file of the current page to obtain a plurality of page tags corresponding to the current page;
and extracting information in the page tags aiming at each page tag to obtain the identification information corresponding to each page tag.
10. The page compatibility processing apparatus according to claim 8 or 9, wherein the identification information includes: at least one of tag type, syntax format, and attribute information.
11. The page compatibility processing apparatus of claim 9, wherein said parsing module is further configured to:
content comparison is carried out on each piece of identification information and each piece of preset identification information in a compatibility information list of the current browser;
and determining whether the identification information is matched with the preset identification information of the current page or not according to the comparison result.
12. The page compatibility processing apparatus of claim 8, wherein said modification module is further configured to:
and storing the updated source file in a local storage module.
13. The page compatibility processing apparatus of claim 12, wherein: the updated source file at least comprises: and the page tag of the current page, the identification information and the target configuration file.
14. The page compatibility processing apparatus of claim 12 or 13, wherein said modification module is further configured to:
retrieving the updated source file from the local storage module in response to a reload operation of the current browser for the current page;
and taking the updated source file as the source file of the current page in the current browser, and loading the current page.
15. A computer device, comprising: comprising a memory and a processor, said memory storing a computer program, characterized in that the processor implements the steps of the method according to any one of claims 1 to 7 when said computer program is executed.
16. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
CN202211084625.1A 2022-09-06 2022-09-06 Page compatibility processing method, device, computer equipment and storage medium Active CN115470127B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211084625.1A CN115470127B (en) 2022-09-06 2022-09-06 Page compatibility processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211084625.1A CN115470127B (en) 2022-09-06 2022-09-06 Page compatibility processing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115470127A CN115470127A (en) 2022-12-13
CN115470127B true CN115470127B (en) 2023-08-15

Family

ID=84368578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211084625.1A Active CN115470127B (en) 2022-09-06 2022-09-06 Page compatibility processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115470127B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103634358A (en) * 2012-08-27 2014-03-12 深圳中兴网信科技有限公司 Browser adaption method and apparatus
CN103942137A (en) * 2013-01-23 2014-07-23 腾讯科技(深圳)有限公司 Browser compatibility testing method and device
CN104156307A (en) * 2014-07-03 2014-11-19 安徽景行信息科技有限公司 Browser compatibility detecting method and system
CN108090069A (en) * 2016-11-22 2018-05-29 北京神州泰岳软件股份有限公司 A kind of method and apparatus for showing web page resources in a browser
CN109947637A (en) * 2017-12-21 2019-06-28 中国移动通信集团重庆有限公司 Webpage compatibility automated test method, device, equipment and medium
CN110083383A (en) * 2019-03-18 2019-08-02 平安普惠企业管理有限公司 Browser style compatibility method, device, computer equipment and storage medium
CN110688300A (en) * 2019-08-13 2020-01-14 平安科技(深圳)有限公司 Compatibility testing method, device, equipment and storage medium
CN111597102A (en) * 2019-02-21 2020-08-28 北京京东尚科信息技术有限公司 Page performance testing method, terminal and storage medium
CN111695076A (en) * 2020-06-15 2020-09-22 荆门汇易佳信息科技有限公司 Cross-browser webpage compatibility standard construction method based on hypertext 5
CN114281325A (en) * 2021-11-25 2022-04-05 广州鲁邦通智能科技有限公司 Method and adjusting unit compatible with mainstream browser style

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3134395A1 (en) * 2019-04-01 2020-10-08 Citrix Systems, Inc. Web page duplication
US11194884B2 (en) * 2019-06-19 2021-12-07 International Business Machines Corporation Method for facilitating identification of navigation regions in a web page based on document object model analysis

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103634358A (en) * 2012-08-27 2014-03-12 深圳中兴网信科技有限公司 Browser adaption method and apparatus
CN103942137A (en) * 2013-01-23 2014-07-23 腾讯科技(深圳)有限公司 Browser compatibility testing method and device
CN104156307A (en) * 2014-07-03 2014-11-19 安徽景行信息科技有限公司 Browser compatibility detecting method and system
CN108090069A (en) * 2016-11-22 2018-05-29 北京神州泰岳软件股份有限公司 A kind of method and apparatus for showing web page resources in a browser
CN109947637A (en) * 2017-12-21 2019-06-28 中国移动通信集团重庆有限公司 Webpage compatibility automated test method, device, equipment and medium
CN111597102A (en) * 2019-02-21 2020-08-28 北京京东尚科信息技术有限公司 Page performance testing method, terminal and storage medium
CN110083383A (en) * 2019-03-18 2019-08-02 平安普惠企业管理有限公司 Browser style compatibility method, device, computer equipment and storage medium
CN110688300A (en) * 2019-08-13 2020-01-14 平安科技(深圳)有限公司 Compatibility testing method, device, equipment and storage medium
CN111695076A (en) * 2020-06-15 2020-09-22 荆门汇易佳信息科技有限公司 Cross-browser webpage compatibility standard construction method based on hypertext 5
CN114281325A (en) * 2021-11-25 2022-04-05 广州鲁邦通智能科技有限公司 Method and adjusting unit compatible with mainstream browser style

Also Published As

Publication number Publication date
CN115470127A (en) 2022-12-13

Similar Documents

Publication Publication Date Title
CN106844217B (en) Method and device for embedding point of applied control and readable storage medium
US10642913B2 (en) Intent and bot based query guidance
US8984485B2 (en) Analysis of source code changes
US9507698B2 (en) Test code generation based on test documentation
US7478305B2 (en) Method and apparatus for interactive generation of device response templates and analysis
CN111079043B (en) Key content positioning method
CN102804147A (en) Code inspection executing system for performing a code inspection of ABAP source codes
CN109308254B (en) Test method, test device and test equipment
CN107133165B (en) Browser compatibility detection method and device
CN111367595B (en) Data processing method, program running method, device and processing equipment
US20180165179A1 (en) Determining incompatibilities of automated test cases with modified user interfaces
US11436133B2 (en) Comparable user interface object identifications
CN115061908A (en) Method and device for positioning defect code, storage medium and computer equipment
CN111881043B (en) Page testing method and device, storage medium and processor
CN111158973B (en) Web application dynamic evolution monitoring method
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN115470127B (en) Page compatibility processing method, device, computer equipment and storage medium
CN114116745A (en) Interface change identification and display method, device, equipment and medium
CN115220731A (en) Index data acquisition method and device, computer equipment and storage medium
CN115705297A (en) Code call detection method, device, computer equipment and storage medium
CN114328572A (en) Data query method, device, system and medium based on SQL parser
CN113094265B (en) Analysis method and analysis device for test script and electronic equipment
CN114168565B (en) Backtracking test method, device and system of business rule model and decision engine
CN113296834B (en) Android closed source service type information extraction method based on reverse engineering
CN112784143B (en) Data processing method, system and computer equipment based on visual computing engine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant