CN116680495A - Page conversion method and device, electronic equipment and storage medium - Google Patents

Page conversion method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116680495A
CN116680495A CN202310648486.9A CN202310648486A CN116680495A CN 116680495 A CN116680495 A CN 116680495A CN 202310648486 A CN202310648486 A CN 202310648486A CN 116680495 A CN116680495 A CN 116680495A
Authority
CN
China
Prior art keywords
page
grammar
conversion
converted
information
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.)
Pending
Application number
CN202310648486.9A
Other languages
Chinese (zh)
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.)
Taiping Financial Technology Services Shanghai Co Ltd Shenzhen Branch
Original Assignee
Taiping Financial Technology Services Shanghai Co Ltd Shenzhen Branch
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 Taiping Financial Technology Services Shanghai Co Ltd Shenzhen Branch filed Critical Taiping Financial Technology Services Shanghai Co Ltd Shenzhen Branch
Publication of CN116680495A publication Critical patent/CN116680495A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • 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/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a page conversion method. The method comprises the following steps: acquiring a page to be converted corresponding to a first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system; converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted; and carrying out at least one page test on the grammar conversion page based on the second browser system, and obtaining a target display page matched with the grammar conversion page according to a test result so as to display the target display page by the second browser system. According to the technical scheme, the page conversion of the main stream browser system to the IE browser system can be realized, so that the main stream browser can be compatible with the access function of the IE browser system, and the conversion efficiency and the system compatibility of the main stream browser are improved through automatic conversion of page formats.

Description

Page conversion method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of browser compatibility, and in particular, to a method, an apparatus, a device, and a medium for page conversion.
Background
Microsoft official publication, called IE browser, will be officially retired at 6.16 of 2022, after which its functions will be plugged by EDGE browser, and there are also a lot of old systems on the market running with IE, and there is an urgent need to solve the related browser compatibility problem.
The general solutions for solving browser compatibility in the market at present are as follows, for EDGE browser, the IE compatibility setting function of EDGE can be used to realize the access of IE browser, the system itself does not need to be modified; for the google browser, an IE Tab plug-in of a third party is used for realizing compatible access of IE, and the system does not need to be modified; reform the front-end code of the old web, redevelop with a new universal JS (javascript, scripting language) standard ES6 (European Computer Manufacturers Association Script, european computer manufacturing association scripting language standard); the compatibility problem is fundamentally solved.
In the process of realizing the invention, the inventor finds that the prior art has the following defects: if the IE system is to be compatible with an EDGE browser, the original system can be used by using the EDGE compatibility setting function, but can only be used in an EDGE compatible mode, if the supporting strategy of the compatibility of the EDGE browser changes, the system cannot be used, the default compatibility validity period is 30 days, and manual reconfiguration is required after expiration; if the IE system is to be compatible with the google browser, the IE Tab plug-in form can be used to be compatible with the web system of the IE, the plug-in is charging software, and the underlying principle of the plug-in is to call the IE kernel of the local system to realize compatibility, once the IE browser is deleted, the plug-in will fail; if the IE system is to be compatible with the mainstream browser, the old front-end code can be modified, and the new JS standard ES6 is adopted for redevelopment, so that the front-end page of the system needs to be completely redeveloped, and the development workload is large.
Disclosure of Invention
The invention provides a page conversion method, a device, equipment and a medium, which enable a main stream browser to be compatible with the access function of an IE browser system, solve the problems of timeliness of compatible service and compatibility of using an IE kernel in the prior art, reduce workload of code development, improve conversion efficiency and system compatibility of the main stream browser through automatic conversion of page formats.
In a first aspect, an embodiment of the present invention provides a page conversion method, where the method includes:
acquiring a page to be converted corresponding to a first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system;
converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted;
and carrying out at least one page test on the grammar conversion page based on the second browser system, and obtaining a target display page matched with the grammar conversion page according to a test result so as to display the target display page by the second browser system.
In a second aspect, an embodiment of the present invention provides an apparatus for converting a page, including:
the page to be converted acquisition module is used for acquiring a page to be converted corresponding to the first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system;
the page conversion module is used for converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted;
the page test module is used for carrying out at least one page test on the grammar conversion page based on the second browser system; and according to the test result, obtaining a target display page matched with the grammar conversion page so as to display a second browser system of the target display page.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of page conversion according to any one of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium storing computer instructions for causing a processor to execute a method for performing page conversion according to any of the embodiments of the present invention.
According to the technical scheme, the first grammar format in the page to be converted is converted into the second grammar format by acquiring the page to be converted, so that the grammar conversion page matched with the page to be converted is obtained, and the page test is performed on the grammar conversion page based on the second browser system, so that the target display page is obtained, the timeliness of compatible service and the compatibility of using an IE kernel in the prior art are solved, the workload of code development is reduced, the conversion efficiency is improved through automatic conversion of the page format, and the system compatibility of the main stream browser is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a page conversion method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a page conversion method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a page conversion device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing a page conversion method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a page conversion method according to an embodiment of the present invention, where the method is applicable to a case where a main stream browser system needs to be compatible with an IE browser system, and the method may be performed by a page conversion device, where the page conversion device may be implemented in a form of hardware and/or software, and the page conversion device may be configured in a terminal or a server having a page access function. As shown in fig. 1, the method includes:
s110, acquiring a page to be converted corresponding to the first browser system.
The page to be converted is written based on a first grammar format adapted by the first browser system.
Further, the first browser system may be an IE browser system, and the first syntax format may be a JS syntax format in an IE browser syntax format.
Illustratively, in this embodiment, the IE browser syntax may be a syntax written by an IE kernel with an IE specific field such as (active. X. Object); furthermore, the grammar with the special field of the IE can only run in the IE browser system of the IE kernel, and has compatibility problem in the main stream browser system without the IE kernel, so the grammar can not be read.
Optionally, the page to be converted may be obtained directly from a web address, or may be obtained by manually inputting a page path of the page to be converted.
S120, converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system, and obtaining a grammar conversion page matched with the page to be converted.
The first grammar format is the original JS grammar format of the history version, and the second grammar format is the target JS grammar format of the current version.
The JS grammar may be a lightweight, interpreted or just-in-time programming language with function priority, may be applied to a scripting language for developing Web pages, javaScript is based on a dynamic scripting language of prototype programming, multiple paradigms, and supports object-oriented, command-oriented, declarative, and functional programming paradigms.
Alternatively, the second browser system may be a mainstream browser in the prior art having a function of accessing pages, such as google browser; further, the second syntax format may be a syntax format applicable to the second browser system.
S130, performing at least one page test on the grammar conversion page based on the second browser system, and obtaining a target display page matched with the grammar conversion page according to a test result so as to display the target display page by the second browser system.
The target display page is matched with the page to be converted, and can be read and displayed by the second browser in a parsing mode; further, if the test result of the page test is successful, the display result of the target display page in the second browser should be the same as the display result of the page to be converted in the first browser.
Optionally, performing a page start test on the grammar conversion page based on the second browser;
adopting a preset automatic testing tool to perform overall system testing on the grammar conversion page passing the page starting test;
and if the grammar conversion page passes the whole system test, taking the grammar conversion page as a page conversion result.
In this embodiment, the page start test may be: directly starting the grammar conversion page through a second browser to obtain a target display page, and testing the functional characteristics of the target display page; further, if the display result of the target display page in the second browser is the same as the display result of the page to be converted in the first browser, the page starting test result is successful; if the display result of the target display page in the second browser is different from the display result of the page to be converted in the first browser, displaying abnormal information by the second browser, manually removing the abnormality, taking the backup page file subjected to error removal processing as a new page to be converted, returning to execute the operation of converting the first grammar format in the page to be converted into the second grammar format adapted by the second browser system, and performing page starting test on the grammar conversion page based on the second browser until the test result of the page starting test of the grammar conversion page is successful.
Optionally, the test objective of the overall system test is to ensure that the tested service functions are normal, where the service functions may be: menu navigation function, page data input function, data processing function, etc.; specifically, if the test result meets the test target, the converted code function is proved to pass acceptance, and the grammar conversion page is used as a page conversion result; if the test result does not meet the test target, a specific functional problem needs to be registered, after the exception is manually removed, the backup page file subjected to error removal processing is used as a new page to be converted, the operation of converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system is returned, and the whole system test is performed on the grammar conversion page based on the second browser until the test result of the whole system test of the grammar conversion page is successful.
According to the technical scheme, the first grammar format in the page to be converted is converted into the second grammar format by acquiring the page to be converted, so that the grammar conversion page matched with the page to be converted is obtained, and the page test is performed on the grammar conversion page based on the second browser system, so that the target display page is obtained, the timeliness of compatible service and the compatibility of using an IE kernel in the prior art are solved, the workload of code development is reduced, the conversion efficiency is improved through automatic conversion of the page format, and the system compatibility of the main stream browser is improved.
Example two
Fig. 2 is a flowchart of a page conversion method according to a second embodiment of the present invention, where the refinement is performed based on the above embodiment, and in this embodiment, the refinement is performed by converting a first syntax format in the page to be converted into a second syntax format adapted by a second browser system, so as to obtain a syntax conversion page matched with the page to be converted, where the refinement is performed by: acquiring page content of the page to be converted; according to the page content of the page to be converted, an IE document mode matched with the page to be converted is obtained; based on the IE document mode, searching the page content of the page to be converted in an original JS grammar format to generate a JS information set; the method comprises the steps of obtaining grammar labels of elements in a JS information set, and converting each piece of JS information in the JS information set into JS mapping information in a universal JS grammar format based on a preset plug-in tool according to the grammar labels so as to obtain the JS mapping information set; converting each JS mapping information in the JS mapping information set into JS conversion information in a target JS grammar format based on a preset plug-in tool so as to obtain the JS conversion information set; and replacing the JS information in the page to be converted by using the JS conversion information to obtain the grammar conversion page.
Accordingly, as shown in fig. 2, the method includes:
s210, acquiring a page to be converted corresponding to the first browser system.
The page to be converted is written based on a first grammar format adapted by the first browser system.
S220, acquiring page content of the page to be converted, and acquiring an IE document mode matched with the page to be converted according to the page content of the page to be converted.
In this embodiment, the target field information is extracted by searching a preset key field for the page content of the target page; further, the matching IE document mode of the target page is obtained through the target field information.
Specifically, after the page content of the page to be converted is obtained, the field information containing the (http-equiv) keywords can be traversed through a search algorithm; further, the field information is extracted to obtain an IE document mode matched with the page to be converted, for example, when the field information of (< meta http-equivalent= "x-ua-compatible" content= "ie=8"/>) is searched, the IE document mode supported by the current page content can be obtained through analysis to be the IE8 mode.
Optionally, before obtaining the IE document mode matched with the page to be converted according to the page content of the page to be converted, the method further includes:
And copying the page to be converted to obtain a backup page file.
Specifically, after the page to be converted is copied, the tail of the copied file is renamed by adding a bak tail prefix, so that a backup page file is obtained; further, the backup page file contains all data materials of the page to be converted.
And S230, searching the page content of the page to be converted in an original JS grammar format based on the IE document mode, and generating a JS information set.
The original JS grammar format is a JS language containing a first grammar format; further, according to the IE document mode, a JS grammar matching the current IE document mode may be obtained.
In this embodiment, if the JS information is obtained, a mapA is individually established for each piece of mutually different JS information, and the JS information is stored in the matched mapas; further, the mapA consists of a key and a value; specifically, the key includes a line number of the currently stored JS information on the current page, and the value includes a syntax of the currently stored JS information.
Optionally, based on the IE document mode, searching an original JS grammar format in the page content of the page to be converted;
Positioning each page information generated by using an original JS grammar format in the page content, and extracting each page information as JS information;
and establishing a JS information set by adopting each JS information. Specifically, the JS information includes a key and a value.
The JS information set is a mapA set established by all mapAs stored in all JS information.
S240, acquiring grammar labels of elements in the JS information collection, and converting each piece of JS information in the JS information collection into JS mapping information in a universal JS grammar format based on a preset plug-in tool according to the grammar labels so as to obtain the JS mapping information collection.
Wherein, the grammar tag is stored in a value in the mapA corresponding to the JS information; further, the grammar tag is in an original JS grammar format.
Optionally, based on a preset plug-in tool, analyzing the grammar tag into a matched JSON object;
generating a universal JS grammar format according to the JSON object;
obtaining a mapping relation between the universal JS grammar format and the original JS grammar format;
and converting each JS information into JS mapping information in a universal JS grammar format according to the mapping relation so as to generate a JS mapping information set.
Specifically, in this embodiment, each element in the JS information set is traversed in a circulating manner to obtain a matched grammar tag; further, according to the grammar tag, the grammar tag is parsed into a JSON object in an AST abstract grammar tree by an official parsing tool of esprima, and the JSON object data is matched in a JS standard AST mapping table. And obtaining a universal JS grammar format matched with the JSON object.
Further, the JS information of the general JS grammar format and the original JS grammar format are paired according to a JSON object, and the general JS grammar format and the JS information with the same matching result are put into the same mapB, so as to obtain the mapping relation between the general JS grammar format and the original JS grammar format.
Further, the JSON objects are matched with a JS standard AST mapping table to obtain mapping relations between the universal JS grammar formats respectively matched with the JSON objects and the original JS grammar formats, so as to obtain a JS mapping information set.
S250, converting each JS mapping information in the JS mapping information set into JS conversion information in a target JS grammar format based on a preset plug-in tool, so as to obtain the JS conversion information set.
Wherein the preset plug-in tool may be an esprima plug-in tool; further, the esprima plug-in tool may convert the information in the general JS syntax format in the JS mapping information into JS conversion information; further, the JS conversion information is composed of a key and a value; specifically, the key includes a line number of the original JS grammar format, which is matched with the JS conversion information, where the JS information is located on the page to be converted, and the value includes a JS grammar of the original JS grammar format, which is matched with the JS conversion information, where the JS information is located on the page to be converted.
And S260, replacing each JS message in the page to be converted by using each JS conversion message to obtain the grammar conversion page.
Optionally, performing a replacement grammar test on each JS conversion information in the JS conversion information collection respectively;
and when all the JS conversion information in the JS conversion information set passes the replacement grammar test, replacing each piece of JS information in the page to be converted by using each piece of JS conversion information to obtain the grammar conversion page.
Specifically, the replacement grammar test traverses each JS conversion information in the set of JS conversion information obtained in S250 in this embodiment; for example, for each JS conversion information, it can be executed in java by Script Engine Manager manager; if the manager shows that the execution result is successful, the JS conversion information is not abnormal, and each JS conversion information in the page to be converted is replaced by each JS conversion information to obtain the grammar conversion page;
optionally, after performing the replacement grammar test on each JS conversion information in the JS conversion information collection set, the method further includes:
if at least one piece of target JS conversion information is determined to not pass the replacement grammar test, generating a grammar error set according to each piece of target JS conversion information;
Calling the backup page file, and performing corresponding error elimination processing on the backup page file based on the grammar error set;
and after the backup page file subjected to error elimination processing is used as a new page to be converted, returning to the operation of converting the first grammar format in the page to be converted into the second grammar format adapted by the second browser system until the grammar conversion page is successfully generated.
Specifically, the replacement grammar test traverses each JS conversion information in the set of JS conversion information obtained in S250 in this embodiment; for example, for each JS conversion information, it can be executed in java by Script Engine Manager manager; if the manager displays that the execution result is abnormal, the manager can directly throw out JS conversion information with abnormal problems, and eliminate abnormal errors, after taking a backup page file subjected to error elimination processing as a new page to be converted, the manager returns to execute the operation of converting a first grammar format in the page to be converted into a second grammar format adapted by a second browser system until the generated grammar conversion page can successfully pass the replacement grammar test.
S270, at least one page test is conducted on the grammar conversion page based on the second browser system, and a test result is obtained.
After the test result is obtained, if the test result is determined to be successful, executing S280; if the execution result is failure, S290 is executed.
S280, obtaining a target display page matched with the grammar conversion page so as to display a second browser system of the target display page.
S290, performing error processing, and returning to execute S220 after taking the backup page file subjected to error elimination processing as a new page to be converted.
According to the technical scheme, the to-be-converted page is obtained, the IE document mode of the to-be-converted page is obtained according to the page content, the JS information collection is generated according to the obtained IE document mode, the JS mapping information collection is obtained based on the obtained JS information collection, the JS information mapping collection is converted into the JS conversion information collection, the JS information in the to-be-converted page is replaced according to the content of the obtained JS information collection, the grammar conversion page is obtained, the page test is carried out on the grammar conversion page based on the second browser system, and then the target display page is obtained, so that the problems of timeliness of compatible service and compatibility of using IE kernel in the prior art are solved, the workload of code development is reduced, the conversion efficiency is improved through automatic conversion of page formats, and the system compatibility of a main stream browser is improved.
Example III
Fig. 3 is a schematic structural diagram of a page conversion device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes:
the page to be converted obtaining module 310 is configured to obtain a page to be converted corresponding to the first browser system, where the page to be converted is written based on a first syntax format adapted by the first browser system;
the page conversion module 320 is configured to convert the first syntax format in the page to be converted into a second syntax format adapted by the second browser system, so as to obtain a syntax conversion page matched with the page to be converted;
a page test module 330, configured to perform at least one page test on the grammar conversion page based on the second browser system; and according to the test result, obtaining a target display page matched with the grammar conversion page so as to display a second browser system of the target display page.
According to the technical scheme, the first grammar format in the page to be converted is converted into the second grammar format by acquiring the page to be converted, so that the grammar conversion page matched with the page to be converted is obtained, and the page test is performed on the grammar conversion page based on the second browser system, so that the target display page is obtained, the timeliness of compatible service and the compatibility of using an IE kernel in the prior art are solved, the workload of code development is reduced, the conversion efficiency is improved through automatic conversion of the page format, and the system compatibility of the main stream browser is improved.
Based on the above embodiment, the page conversion module 320 may include:
the page content acquisition unit is used for acquiring page content of the page to be converted;
the document mode acquisition unit is used for acquiring an IE document mode matched with the page to be converted according to the page content of the page to be converted;
the JS information set generating unit is used for searching the page content of the page to be converted in an original JS grammar format based on the IE document mode to generate a JS information set;
the JS mapping information set generating unit is used for acquiring grammar labels of all elements in the JS information set, and converting all JS information in the JS information set into JS mapping information in a universal JS grammar format based on a preset plug-in tool according to the grammar labels so as to obtain the JS mapping information set;
the JS conversion information set generating unit is used for converting each JS mapping information in the JS mapping information set into JS conversion information in a target JS grammar format based on a preset plug-in tool so as to obtain the JS conversion information set;
and the grammar conversion page generation unit is used for replacing the JS information in the page to be converted by using the JS conversion information to obtain the grammar conversion page.
Based on the above embodiments, the JS information aggregate generating unit further includes:
the grammar format searching unit is used for searching an original JS grammar format in the page content of the page to be converted based on the IE document mode;
the JS information extraction unit is used for positioning each page information generated by using the original JS grammar format in the page content, and extracting each page information as JS information;
and the JS information set establishing unit is used for establishing the JS information set by adopting each JS information.
Based on the above embodiments, the JS mapping information aggregate generating unit further includes:
the JSON object generation unit is used for analyzing the grammar tag into a matched JSON object based on a preset plug-in tool;
the universal JS grammar format generating unit is used for generating a universal JS grammar format according to the JSON object;
the mapping relation obtaining unit is used for obtaining the mapping relation between the universal JS grammar format and the original JS grammar format;
and the JS information conversion unit is used for converting each piece of JS information into JS mapping information in a universal JS grammar format according to the mapping relation so as to generate a JS mapping information set.
On the basis of the above embodiments, the syntax conversion page generation unit further includes:
the test unit is used for respectively carrying out replacement grammar test on each JS conversion information in the JS conversion information set;
and the information replacing unit is used for replacing each JS information in the page to be converted by using each JS conversion information when all JS conversion information in the JS conversion information set passes the replacement grammar test, so as to obtain the grammar conversion page.
On the basis of the above embodiments, the document mode obtaining unit further includes:
the backup unit is used for copying the page to be converted to obtain a backup page file;
on the basis of the above embodiments, the test unit further includes:
a syntax error set generating unit, configured to generate a syntax error set according to each target JS conversion information if it is determined that at least one target JS conversion information fails the replacement syntax test;
the error processing unit is used for calling the backup page file and carrying out corresponding error elimination processing on the backup page file based on the grammar error set;
and the return execution unit is used for returning to execute the operation of converting the first grammar format in the page to be converted into the second grammar format adapted by the second browser system after taking the backup page file subjected to error elimination processing as a new page to be converted until the grammar conversion page is successfully generated.
Based on the above embodiments, the page test module 330 may include:
the starting test unit is used for carrying out page starting test on the grammar conversion page based on the second browser;
the whole system testing unit is used for carrying out whole system testing on the grammar conversion page which passes the page start test by adopting a preset automatic testing tool;
and the result determining unit is used for taking the grammar conversion page as a page conversion result if the grammar conversion page passes the overall system test.
The page conversion device provided by the embodiment of the invention can execute the page conversion method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, such as the page conversion method.
Specifically, the method comprises the following steps:
acquiring a page to be converted corresponding to a first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system;
converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted;
and carrying out at least one page test on the grammar conversion page based on the second browser system, and obtaining a target display page matched with the grammar conversion page according to a test result so as to display the target display page by the second browser system.
In some embodiments, the page conversion method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the page translation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the page conversion method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of page conversion, comprising:
acquiring a page to be converted corresponding to a first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system;
converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted;
and carrying out at least one page test on the grammar conversion page based on the second browser system, and obtaining a target display page matched with the grammar conversion page according to a test result so as to display the target display page by the second browser system.
2. The method of claim 1, wherein the first syntax format is a history version of the original JS syntax format and the second syntax format is a current version of the target JS syntax format;
converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted, wherein the method comprises the following steps:
acquiring page content of the page to be converted;
according to the page content of the page to be converted, an IE document mode matched with the page to be converted is obtained;
Based on the IE document mode, searching the page content of the page to be converted in an original JS grammar format to generate a JS information set;
the method comprises the steps of obtaining grammar labels of elements in a JS information set, and converting each piece of JS information in the JS information set into JS mapping information in a universal JS grammar format based on a preset plug-in tool according to the grammar labels so as to obtain the JS mapping information set;
converting each JS mapping information in the JS mapping information set into JS conversion information in a target JS grammar format based on a preset plug-in tool so as to obtain the JS conversion information set;
and replacing the JS information in the page to be converted by using the JS conversion information to obtain the grammar conversion page.
3. The method of claim 2, wherein searching for the page content of the page to be converted in the original JS syntax format based on the IE document schema, generating a set of JS information sets, includes:
searching an original JS grammar format in page contents of the page to be converted based on the IE document mode;
positioning each page information generated by using an original JS grammar format in the page content, and extracting each page information as JS information;
And establishing a JS information set by adopting each JS information.
4. The method of claim 2, wherein obtaining the syntax tag of each element in the JS information collection, and converting each JS information in the JS information collection into JS map information in a universal JS syntax format based on the preset plug-in tool according to the syntax tag, to obtain the JS map information collection, includes:
analyzing the grammar tag into a matched JSON object based on a preset plug-in tool;
generating a universal JS grammar format according to the JSON object;
obtaining a mapping relation between the universal JS grammar format and the original JS grammar format;
and converting each JS information into JS mapping information in a universal JS grammar format according to the mapping relation so as to generate a JS mapping information set.
5. The method of claim 2, wherein replacing each JS information in the page to be converted with each JS conversion information to obtain the grammar conversion page, includes:
performing a replacement grammar test on each JS conversion information in the JS conversion information set respectively;
and when all the JS conversion information in the JS conversion information set passes the replacement grammar test, replacing each piece of JS information in the page to be converted by using each piece of JS conversion information to obtain the grammar conversion page.
6. The method according to claim 2, further comprising, before obtaining an IE document pattern matching the page to be converted according to the page content of the page to be converted:
copying the page to be converted to obtain a backup page file;
after the replacing grammar test is performed on each JS conversion information in the JS conversion information set respectively, the method further comprises:
if at least one piece of target JS conversion information is determined to not pass the replacement grammar test, generating a grammar error set according to each piece of target JS conversion information;
calling the backup page file, and performing corresponding error elimination processing on the backup page file based on the grammar error set;
and after the backup page file subjected to error elimination processing is used as a new page to be converted, returning to the operation of converting the first grammar format in the page to be converted into the second grammar format adapted by the second browser system until the grammar conversion page is successfully generated.
7. The method according to any one of claims 1 to 6, wherein performing at least one page test on the grammar conversion page based on the second browser system, and obtaining a target presentation page matched with the grammar conversion page according to the test result, includes:
Performing page starting test on the grammar conversion page based on the second browser;
adopting a preset automatic testing tool to perform overall system testing on the grammar conversion page passing the page starting test;
and if the grammar conversion page passes the whole system test, taking the grammar conversion page as a page conversion result.
8. An apparatus for converting a page, comprising:
the page to be converted acquisition module is used for acquiring a page to be converted corresponding to the first browser system, wherein the page to be converted is written based on a first grammar format adapted by the first browser system;
the page conversion module is used for converting the first grammar format in the page to be converted into a second grammar format adapted by a second browser system to obtain a grammar conversion page matched with the page to be converted;
the page test module is used for carrying out at least one page test on the grammar conversion page based on the second browser system; and according to the test result, obtaining a target display page matched with the grammar conversion page so as to display a second browser system of the target display page.
9. An electronic device, the electronic device comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of page conversion of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the method of page conversion of any one of claims 1-7.
CN202310648486.9A 2023-05-26 2023-06-02 Page conversion method and device, electronic equipment and storage medium Pending CN116680495A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310611642 2023-05-26
CN2023106116424 2023-05-26

Publications (1)

Publication Number Publication Date
CN116680495A true CN116680495A (en) 2023-09-01

Family

ID=87781778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310648486.9A Pending CN116680495A (en) 2023-05-26 2023-06-02 Page conversion method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116680495A (en)

Similar Documents

Publication Publication Date Title
CN110858172A (en) Automatic test code generation method and device
CN116089258A (en) Data migration test method, device, equipment, storage medium and program product
CN117076719A (en) Database joint query method, device and equipment based on large language model
CN113609100B (en) Data storage method, data query device and electronic equipment
CN114816578A (en) Method, device and equipment for generating program configuration file based on configuration table
CN113032258A (en) Electronic map testing method and device, electronic equipment and storage medium
CN116467161A (en) Application testing method and device, electronic equipment and storage medium
CN116680495A (en) Page conversion method and device, electronic equipment and storage medium
CN115309706A (en) Method, device, equipment, medium and product for updating multi-language configuration file
CN110852077B (en) Method, device, medium and electronic equipment for dynamically adjusting Word2Vec model dictionary
CN113835893B (en) Data processing method, device, equipment, storage medium and program product
CN117573561B (en) Automatic test system, method, electronic equipment and storage medium
CN116303071A (en) Interface testing method and device, electronic equipment and storage medium
CN114860312A (en) Mobile terminal adaptation method, device, equipment and medium based on credit business
CN117234521A (en) File compiling method, device, equipment and storage medium
CN116150031A (en) Program performance test early warning method, device, equipment and storage medium
CN115238212A (en) Page designated element detection and replacement method, device, equipment and storage medium
CN116521903A (en) Component entity extraction method, device, equipment and medium
CN118193027A (en) Firmware associated information updating method, device, equipment and medium
CN116841982A (en) Database migration method, device, equipment, storage medium and program product
CN117093274A (en) Application running stack analysis method, device, equipment and storage medium
CN115167855A (en) Front-end page generation method, device and equipment applied to matching transaction system
CN117827637A (en) Automatic test method and device and electronic equipment
CN117056222A (en) Interface test file generation method and device, electronic equipment and storage medium
CN115904584A (en) Multi-language switching method, device, equipment and storage medium for application

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