CN116431950A - Web control element management method and device, electronic equipment and medium - Google Patents

Web control element management method and device, electronic equipment and medium Download PDF

Info

Publication number
CN116431950A
CN116431950A CN202310413121.8A CN202310413121A CN116431950A CN 116431950 A CN116431950 A CN 116431950A CN 202310413121 A CN202310413121 A CN 202310413121A CN 116431950 A CN116431950 A CN 116431950A
Authority
CN
China
Prior art keywords
control
web
web control
menu page
menu
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
CN202310413121.8A
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202310413121.8A priority Critical patent/CN116431950A/en
Publication of CN116431950A publication Critical patent/CN116431950A/en
Pending legal-status Critical Current

Links

Images

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/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

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

Abstract

The invention relates to the field of artificial intelligence, and discloses a Web control element management method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving account information of a Web system; clicking the menus in the Web system one by one according to the account information to obtain a menu page set; identifying the Web control of each menu page in the menu page set, and marking the unique number of the Web control; acquiring HTML source codes of a menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path; checking the control positioning path, editing the Web control corresponding to the control positioning path which fails to check, and performing secondary check on the edited Web control to obtain a check result; and when the verification result is successful, storing the Web control and the control positioning path into a preset database. The invention can improve the management efficiency and the management intelligent degree of the Web control elements.

Description

Web control element management method and device, electronic equipment and medium
Technical Field
The present invention relates to the field of artificial intelligence, and in particular, to a method and apparatus for managing Web control elements, an electronic device, and a readable storage medium.
Background
The Web control refers to encapsulation of data and methods in a global wide area network, the existing common Web control element management method is generally to click to acquire positioning of the Web control element in a manual mode through an element positioning tool on a browser, and then verify whether the acquired positioning is effective in a script-driven mode.
Disclosure of Invention
The invention provides a method and a device for managing Web control elements, electronic equipment and a readable storage medium, and aims to improve the management efficiency and the management intelligent degree of the Web control elements.
In order to achieve the above object, the present invention provides a Web control element management method, which includes:
receiving basic information of a Web system, and reading account information in the basic information by using a preset page crawler mechanism;
clicking the menus in the Web system one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set;
According to an image recognition algorithm, recognizing a Web control of each menu page in the menu page set, and uniquely marking the Web control to obtain a unique number of the Web control;
acquiring HTML source codes of each menu page in the menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
checking the control positioning path, editing the Web control corresponding to the control positioning path which fails to check, and performing secondary check on the edited Web control to obtain a check result;
when the verification result is failure, returning to the step of verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, and performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful;
and when the verification result is successful, storing the Web control and the control positioning path into a preset database.
Optionally, clicking the menus in the Web system one by using a menu traversal algorithm according to the account information to obtain a menu page set, including:
According to the account information, calling a preset Webdriver library to log in the Web system to obtain a target Web system after logging in the account;
searching menu pages of all target Web systems by using a click interface in the webdriver library to obtain an initial menu page set;
traversing the primary menu in the initial menu page set to obtain a primary menu page set;
acquiring a primary menu ID of a primary menu in the primary menu page set, traversing the initial menu page set according to the primary menu ID to obtain a secondary menu page set, and continuing traversing the initial menu page set according to the secondary menu ID of a secondary menu in the secondary menu page set until a corresponding menu page cannot be queried to obtain a multi-level menu page set;
and carrying out layered integration on the primary menu page set, the secondary menu page set and the multi-level menu page set to obtain a menu page set.
Optionally, analyzing the HTML source code according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control, including:
analyzing the HTML source codes to obtain HTML source code body parts;
searching Web control source codes with control element marks from the HTML source code body part;
And inquiring the Web control source codes according to the unique numbers of the Web controls to obtain control positioning paths corresponding to each Web control.
Optionally, the identifying the Web control of each menu page in the menu page set according to the image identification algorithm includes:
extracting a global feature vector of each icon in each menu page;
calculating the global similarity of the global feature vector and the global feature vector of a preset Web control template image;
extracting local feature vectors of icons with global similarity higher than a first preset threshold value;
and calculating the local similarity of the local feature vector and the local feature vector of the preset Web control template image, and taking a menu page element corresponding to an icon with the local similarity higher than a second preset threshold value as a Web control.
Optionally, the uniquely marking the Web control to obtain a unique number of the Web control includes:
searching a menu page set position of a menu page where the Web control is located in the menu page set, and generating a Web control large number according to the menu page set position;
searching a menu page position of the Web control in a menu page where the Web control is located, and generating a Web control small number according to the menu page position;
And combining the large number of the Web control with the small number of the Web control to obtain the unique number of the Web control.
Optionally, the verifying the control positioning path includes:
traversing the Web control data in the HTML source code by using a preset element positioning mechanism to obtain detailed information of each Web control;
generating an absolute path of each Web control by using an Xpath language according to the detailed information;
judging whether the absolute path is consistent with a control positioned by the control positioning path;
when the absolute path is consistent with the control positioned by the control positioning path, judging that the control positioning path is successfully checked;
and when the absolute path is inconsistent with the control positioned by the control positioning path, judging that the control positioning path fails to check.
Optionally, the reading the account information in the basic information by using a preset page crawler mechanism includes:
acquiring an IP address of a storage server corresponding to the basic information by using a preset programming language;
screening out a target index address related to the basic information from the storage server corresponding to the basic information by using a webpage analysis algorithm, and storing the target index address into a queue to be grabbed;
Grabbing target index addresses from the queue to be grabbed according to a preset searching strategy until the target index addresses meet a preset limit, and stopping grabbing the target index addresses;
and carrying out information analysis on the basic information corresponding to the target index address, and filtering according to the analysis result to obtain account information.
In order to solve the above problems, the present invention further provides a Web control element management apparatus, the apparatus comprising:
the menu acquisition module is used for receiving basic information of the Web system, reading account information in the basic information by using a preset page crawler mechanism, and clicking menus in the Web system one by using a menu traversal algorithm according to the account information to obtain a menu page set;
the positioning path acquisition module is used for identifying the Web control of each menu page in the menu page set according to an image identification algorithm, uniquely marking the Web control to obtain a unique number of the Web control, acquiring the HTML source code of each menu page in the menu page set, and analyzing the HTML source code according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
And the positioning path verification module is used for verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, performing secondary verification on the edited Web control to obtain a verification result, returning to verify the control positioning path when the verification result is failed, editing the Web control corresponding to the control positioning path which fails to verify, performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful, and storing the Web control and the control positioning path into a preset database when the verification result is successful.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one computer program; and
And the processor executes the computer program stored in the memory to realize the Web control element management method.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-mentioned Web control element management method.
According to the embodiment of the invention, the menu in the Web system is clicked one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set, so that the menu page set is constructed, the order of the menu pages is ensured, convenience is provided for the unique marking of the subsequent Web control, further, the unique marking of the Web control is carried out to obtain the unique number of the Web control, the number of the Web control is ensured not to be repeated, thereby reducing the probability of the reading error of the Web control, improving the management efficiency of the Web control element, secondly, the HTML source code of each menu page in the menu page set is obtained, the HTML source code is analyzed according to the unique number of the Web control, the control positioning path corresponding to the Web control is obtained, the labor participation is reduced, the investment of labor cost is reduced, the positioning speed of the Web control element is accelerated, the management intelligent degree and the management efficiency of the Web control element are improved, and finally, the verification of the Web control corresponding to the positioning path of the control is carried out for the second verification until the positioning path is completely verified, the accuracy of the Web control element corresponding to the Web control element is ensured, and the accuracy of the control element management accuracy of the Web element is improved. Therefore, the method, the device, the equipment and the storage medium for managing the Web control elements can improve the management efficiency and the management intelligent degree of the Web control elements.
Drawings
FIG. 1 is a flowchart of a method for managing Web control elements according to an embodiment of the present invention;
FIGS. 2 to 3 are flowcharts illustrating a detailed implementation of one of the steps in the method for managing Web control elements according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a Web control element management device according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an internal structure of an electronic device for implementing a Web control element management method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the invention provides a Web control element management method. The execution subject of the Web control element management method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the Web control element management method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The server may include an independent server, and may also include a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flowchart of a Web control element management method according to an embodiment of the present invention is shown, where in the embodiment of the present invention, the Web control element management method includes:
s1, receiving basic information of a Web system, and reading account information in the basic information by using a preset page crawler mechanism.
In the embodiment of the invention, the Web system can be a global, dynamic interactive and cross-platform distributed graphic information system based on hypertext and HTTP. The basic information comprises information such as URL (uniform resource locator), account number, password and the like of the Web system, wherein the URL can be a representation method for specifying the information position on the Web system. The crawler mechanism can be a mechanism for acquiring data in batches and efficiently by utilizing the high-speed advantage of a computer through a written program. The account information may be account information and corresponding password information in the basic information.
In an alternative embodiment of the invention, when the front-end control panel of the Web system receives the basic information of the Web system, the front-end data exchange module is used for sending the basic information to the server of the Web system, so that the basic information of the Web system is received.
According to the embodiment of the invention, the account information in the basic information is read by using the preset page crawler mechanism, so that the back end of the Web system can log in the appointed system, the management of the control elements of the Web system is realized, the manual operation is reduced, and the intelligent degree of the control element management of the Web system is improved.
Further, as an optional embodiment of the present invention, referring to fig. 2, the step of reading account information in the basic information by using a preset page crawler mechanism in S1 includes:
s11, acquiring an IP address of a storage server corresponding to the basic information by using a preset programming language;
s12, screening out a target index address related to the basic information from a storage server corresponding to the basic information by using a webpage analysis algorithm, and storing the target index address into a queue to be grabbed;
s13, grabbing target index addresses from the queues to be grabbed according to a preset searching strategy until the target index addresses meet a preset limit, and stopping grabbing the target index addresses;
s14, carrying out information analysis on the basic information corresponding to the target index address, and filtering according to the analysis result to obtain account information.
In the embodiment of the invention, the programming language may be a programming language such as Python language or C language. The basic information storage server may be a server for storing basic information at a server side of the Web system. The target index address may be an index address of a database storing the basic information. The web page analysis algorithm can be PageRank or HITS algorithm. The preset searching strategy can be to grasp according to whether the target index address contains the needed information.
In an alternative embodiment of the invention, a crawler instruction is written through a Python programming language, and the account information is crawled from the basic information storage server according to the crawler instruction, so that the time for manually screening the information is reduced, the speed for collecting the account information is increased, and the positioning efficiency of Web control elements is improved.
S2, clicking the menus in the Web system one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set.
In the embodiment of the present invention, the menu traversal algorithm may be a recursive traversal algorithm.
According to the account information, the menu traversing algorithm is utilized to click the menus in the Web system one by one to obtain the menu page set, and the set of the Web system menu is realized, so that the control elements in the Web system menu are convenient to manage in a centralized manner, and the Web control element management is simplified.
Further, as an alternative embodiment of the present invention, referring to fig. 3, the S2 includes:
s21, calling a preset Webdriver library to log in the Web system according to the account information to obtain a target Web system after logging in the account;
s22, searching menu pages of all target Web systems by utilizing a click interface in the webdriver library to obtain an initial menu page set;
s23, traversing a first-level menu in the initial menu page set to obtain a first-level menu page set;
s24, acquiring a primary menu ID of a primary menu in the primary menu page set, traversing the initial menu page set according to the primary menu ID to obtain a secondary menu page set, and continuing traversing the initial menu page set according to a secondary menu ID of a secondary menu in the secondary menu page set until a corresponding menu page cannot be queried to obtain a multi-level menu page set;
s25, layering and integrating the primary menu page set, the secondary menu page set and the multi-level menu page set to obtain a menu page set.
In the embodiment of the invention, the webdriver library can be an automatic testing tool based on a Web system application program. The primary menu may be a menu displayed directly on the Web system page. The secondary menu may be a menu directly displayed on the primary menu page.
In an alternative embodiment of the present invention, because the menu ID of the previous menu page is the same as the parent ID of the next menu page, the menu page corresponding to the next menu page can be obtained by querying the menu page with the parent ID in the initial menu page set as the menu ID of the previous menu page.
In the embodiment of the invention, the menu pages of the Web system are hierarchically classified by using a layer-by-layer progressive method, so that the construction of a menu page set is realized, the order of the menu pages is ensured, and convenience is provided for the unique marking of the follow-up Web control.
And S3, identifying the Web control of each menu page in the menu page set according to an image identification algorithm, and uniquely marking the Web control to obtain a unique number of the Web control.
In the embodiment of the invention, the image recognition algorithm may be a recognition algorithm based on deep learning, and is commonly used for recognizing images. The Web control may be an encapsulation of data and methods in a Web system, typically in a fixed picture style, presented in each level of menu pages.
According to the embodiment of the invention, the Web control of each menu page in the menu page set is identified according to the image identification algorithm, so that the acquisition of the control elements in the Web system is realized, the labor investment is reduced, the intelligent degree of the acquisition of the control elements of the Web system is improved, and the management efficiency of the Web control elements is improved.
Further, as an optional embodiment of the present invention, the identifying, according to the image recognition algorithm in S3, the Web control of each menu page in the menu page set includes:
extracting a global feature vector of each icon in each menu page;
calculating the global similarity of the global feature vector and the global feature vector of a preset Web control template image;
extracting local feature vectors of icons with global similarity higher than a first preset threshold value;
and calculating the local similarity of the local feature vector and the local feature vector of the preset Web control template image, and taking a menu page element corresponding to an icon with the local similarity higher than a second preset threshold value as a Web control.
In an embodiment of the present invention, the global feature vector includes color features, texture features, and shape features, such as intensity histograms. The local feature vector may be a local representation of an image feature of an icon of the menu page reflecting a local feature present on the image.
In an alternative embodiment of the present invention, the global feature vector only includes color features, texture features and shape features, so that after the global features of the icons in the menu page are extracted, only one blurred icon feature can be obtained, and the icons cannot be determined to be Web control icons, so that further extraction of local features of the icons subjected to similarity screening and similarity calculation are required to determine whether the icons are Web control icons.
In an alternative embodiment of the invention, the global feature vector of each icon in each menu page can be extracted by using a two-dimensional discrete Fourier transform formula, and the local feature vector of the icon with the global similarity higher than a preset threshold value can be extracted by using a kernel function of a two-dimensional Gabor wavelet, so that the accuracy of the global feature vector is ensured, and the accuracy of positioning the Web control elements is further improved.
In another optional embodiment of the invention, the global similarity between the global feature vector and the global feature vector of the preset Web control template image can be calculated by using a normalized cross correlation algorithm, and the local similarity between the local feature vector and the local feature vector of the preset Web control template image can be calculated by using a similarity algorithm, so that the accuracy of positioning the Web control elements is improved.
Further, the embodiment of the invention uniquely marks the Web control to obtain the unique number of the Web control, thereby ensuring the uniformity and order of the management of the control elements of the Web system, simplifying the management difficulty of the control elements of the Web system and improving the management efficiency of the control elements of the Web system.
In detail, the step S3 of uniquely marking the Web control to obtain a unique number of the Web control includes:
Searching a menu page set position of a menu page where the Web control is located in the menu page set, and generating a Web control large number according to the menu page set position;
searching a menu page position of the Web control in a menu page where the Web control is located, and generating a Web control small number according to the menu page position;
and combining the large number of the Web control with the small number of the Web control to obtain the unique number of the Web control.
In an alternative embodiment of the invention, the Web control is numbered according to the position of the menu page where the Web control is positioned in the menu page set and the position of the Web control in the menu page, so that the unique number of the Web control is obtained, each Web control is ensured to have unique characteristics, the subsequent generation of a Web control positioning path is facilitated, and the uniqueness of the path is ensured.
S4, acquiring HTML source codes of each menu page in the menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control.
In the embodiment of the invention, the HTML source code may be a code that combines HTML grammars with each other to display pictures and characters in our browser, where the HTML may be a language in which some words are marked to achieve a specific effect. The control positioning path may be a language that determines the control element position.
In an alternative embodiment of the invention, the HTML source code of each menu page in the menu page set is crawled by the page crawler, so that the acquisition of the HTML source code of the menu page is realized, the investment of manpower is reduced, and the positioning speed of Web control elements is accelerated.
According to the embodiment of the invention, the HTML source code is analyzed according to the unique number of the Web control, so that a control positioning path corresponding to the Web control is obtained, the step of manually clicking to acquire the positioning of the Web control element is reduced, the intelligent degree of positioning of the Web control element and the positioning efficiency of acquiring the Web control element are improved, and the management difficulty of the Web control element is reduced.
Further, as an optional embodiment of the present invention, in S4, analyzing the HTML source code according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control, including:
analyzing the HTML source codes to obtain HTML source code body parts;
searching Web control source codes with control element marks from the HTML source code body part;
and inquiring the Web control source codes according to the unique numbers of the Web controls to obtain control positioning paths corresponding to each Web control.
In the embodiment of the invention, the control element marks comprise marks such as < input >, < textarea > </textarea >, < select > </select >, and the like, for example, < input type= "text" > in which type is an attribute of the control, and "text" is a unique number of the control element.
In the alternative embodiment of the invention, because each Web control has a unique number, namely unique characteristic, when the control positioning path corresponding to the Web control is acquired, the relative path in the Xpath language can be adopted to represent the control positioning path corresponding to each Web control, thereby simplifying the positioning path length of the Web control and improving the positioning efficiency of the Web control elements.
S5, checking the control positioning path, editing the Web control corresponding to the control positioning path with failed check, and performing secondary check on the edited Web control to obtain a check result.
According to the embodiment of the invention, the control positioning path is checked, so that the detailed information of the Web control is ensured to be accurate, the management of each Web control element is realized, and the management accuracy of the Web control element is improved.
Further, as an optional embodiment of the present invention, the verifying the control positioning path in S5 includes:
traversing the Web control data in the HTML source code by using a preset element positioning mechanism to obtain detailed information of each Web control;
generating an absolute path of each Web control by using an Xpath language according to the detailed information;
Judging whether the absolute path is consistent with a control positioned by the control positioning path;
when the absolute path is consistent with the control positioned by the control positioning path, judging that the control positioning path is successfully checked;
and when the absolute path is inconsistent with the control positioned by the control positioning path, judging that the control positioning path fails to check.
In the embodiment of the invention, the Xpath language can be a language for determining the position of a certain part in the XML document, and the HTML source code is generally in the XML document format, so that the Xpath language can be adopted for description. The absolute path refers to a specific position of a place by taking an absolute fixed starting point as a reference object, for example, in the positioning process of a Web control element, the fixed starting point of an HTML file is usually taken as a reference.
In an alternative embodiment of the invention, because the absolute path is different from the expression mode of the control positioning path, positioning failure possibly occurs in the positioning process of the Web control element, and therefore, the control positioning path needs to be checked to ensure that the control positioning path of each control is accurate, thereby improving the accuracy of the management of the Web control element.
In an alternative embodiment of the invention, when verification of the control positioning path fails, editing operation of the Web control can be realized by editing the corresponding Web control at the front end, verification clicking operation is performed on the edited Web control, and further, when a verification request is received by a server, verification is performed on latest incoming front-end Web control data to obtain a corresponding Web control verification result.
S6, judging whether the verification result is successful or not.
In an alternative embodiment of the invention, since the editing operation of the Web control corresponding to the control positioning path with failed verification is not necessarily capable of ensuring that the Web control data is accurate in secondary verification, the verification result of the secondary verification is also required to be integrated by carding, thereby ensuring that the control data of each control is accurate.
And when the verification result is failure, returning to the step corresponding to the step S7 until the verification result is all successful.
In an alternative embodiment of the invention, when the verification result is failure, namely, a Web control with failed verification of the control positioning path exists, therefore, the Web control corresponding to the control positioning path with failed verification needs to be edited again until the verification result is all successful, and the detailed information of the Web control is ensured to be accurate, thereby realizing the management of each Web control element and improving the management accuracy of the Web control element.
And when the verification result is successful, S8, storing the Web control and the control positioning path into a preset database.
In an alternative embodiment of the invention, when the verification result is successful, that is, when the verification of the control positioning path of each Web control is successful, in order to facilitate the management of the control positioning path corresponding to the accurate Web control data set, the Web control and the control positioning path can be stored in a preset database, thereby facilitating the realization of the management of the Web control elements and simplifying the management difficulty of the Web control elements.
According to the embodiment of the invention, the menu in the Web system is clicked one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set, so that the menu page set is constructed, the order of the menu pages is ensured, convenience is provided for the unique marking of the subsequent Web control, further, the unique marking of the Web control is carried out to obtain the unique number of the Web control, the number of the Web control is ensured not to be repeated, thereby reducing the probability of the reading error of the Web control, improving the management efficiency of the Web control element, secondly, the HTML source code of each menu page in the menu page set is obtained, the HTML source code is analyzed according to the unique number of the Web control, the control positioning path corresponding to the Web control is obtained, the labor participation is reduced, the investment of labor cost is reduced, the positioning speed of the Web control element is accelerated, the management intelligent degree and the management efficiency of the Web control element are improved, and finally, the verification of the Web control corresponding to the positioning path of the control is carried out for the second verification until the positioning path is completely verified, the accuracy of the Web control element corresponding to the Web control element is ensured, and the accuracy of the control element management accuracy of the Web element is improved. Therefore, the Web control element management method provided by the invention can improve the management efficiency and the management intelligent degree of the Web control element.
As shown in fig. 4, a functional block diagram of the Web control element management apparatus of the present invention is shown.
The Web control element management apparatus 100 of the present invention may be installed in an electronic device. Depending on the implemented functions, the Web control element management apparatus 100 may include a menu obtaining module 101, a positioning path obtaining module 102, and a positioning path checking module 103, where the modules may also be referred to as a unit, and refer to a series of computer program segments that can be executed by a processor of an electronic device and can perform a fixed function, and are stored in a memory of the electronic device.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the menu obtaining module 101 is configured to receive basic information of a Web system, read account information in the basic information by using a preset page crawler mechanism, and click a menu in the Web system one by using a menu traversal algorithm according to the account information, so as to obtain a menu page set.
The positioning path obtaining module 102 is configured to identify, according to an image recognition algorithm, a Web control of each menu page in the menu page set, and uniquely mark the Web control to obtain a unique number of the Web control, obtain an HTML source code of each menu page in the menu page set, and parse the HTML source code according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control.
The positioning path verification module 103 is configured to verify the control positioning path, edit the Web control corresponding to the control positioning path that fails to verify, perform secondary verification on the edited Web control to obtain a verification result, when the verification result is failure, return to verify the control positioning path, edit the Web control corresponding to the control positioning path that fails to verify, perform secondary verification on the edited Web control to obtain a verification result, until the verification result is all successful, and when the verification result is successful, store the Web control and the control positioning path into a preset database.
Fig. 5 is a schematic structural diagram of an electronic device for implementing the Web control element management method according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a Web control element management program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various types of data, such as code of a Web control element management program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing Unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules (e.g., web Control element management program, etc.) stored in the memory 11, and calling data stored in the memory 11.
The communication bus 12 may be a peripheral component interconnect standard (PerIPheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
Fig. 5 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 5 is not limiting of the electronic device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
Optionally, the communication interface 13 may comprise a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The Web control element management program stored in the memory 11 in the electronic device is a combination of a plurality of computer programs, which when run in the processor 10, can implement:
receiving basic information of a Web system, and reading account information in the basic information by using a preset page crawler mechanism;
clicking the menus in the Web system one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set;
According to an image recognition algorithm, recognizing a Web control of each menu page in the menu page set, and uniquely marking the Web control to obtain a unique number of the Web control;
acquiring HTML source codes of each menu page in the menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
checking the control positioning path, editing the Web control corresponding to the control positioning path which fails to check, and performing secondary check on the edited Web control to obtain a check result;
when the verification result is failure, returning to the step of verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, and performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful;
and when the verification result is successful, storing the Web control and the control positioning path into a preset database.
In particular, the specific implementation method of the processor 10 on the computer program may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. The computer readable medium may be non-volatile or volatile. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, may implement:
receiving basic information of a Web system, and reading account information in the basic information by using a preset page crawler mechanism;
clicking the menus in the Web system one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set;
according to an image recognition algorithm, recognizing a Web control of each menu page in the menu page set, and uniquely marking the Web control to obtain a unique number of the Web control;
Acquiring HTML source codes of each menu page in the menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
checking the control positioning path, editing the Web control corresponding to the control positioning path which fails to check, and performing secondary check on the edited Web control to obtain a check result;
when the verification result is failure, returning to the step of verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, and performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful;
and when the verification result is successful, storing the Web control and the control positioning path into a preset database.
Further, the computer-usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed electronic device, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. A Web control element management method, the method comprising:
receiving basic information of a Web system, and reading account information in the basic information by using a preset page crawler mechanism;
clicking the menus in the Web system one by utilizing a menu traversal algorithm according to the account information to obtain a menu page set;
according to an image recognition algorithm, recognizing a Web control of each menu page in the menu page set, and uniquely marking the Web control to obtain a unique number of the Web control;
acquiring HTML source codes of each menu page in the menu page set, and analyzing the HTML source codes according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
checking the control positioning path, editing the Web control corresponding to the control positioning path which fails to check, and performing secondary check on the edited Web control to obtain a check result;
When the verification result is failure, returning to the step of verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, and performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful;
and when the verification result is successful, storing the Web control and the control positioning path into a preset database.
2. The method for managing Web control elements according to claim 1, wherein clicking the menus in the Web system one by one according to the account information by using a menu traversal algorithm to obtain a menu page set comprises:
according to the account information, calling a preset Webdriver library to log in the Web system to obtain a target Web system after logging in the account;
searching menu pages of all target Web systems by using a click interface in the webdriver library to obtain an initial menu page set;
traversing the primary menu in the initial menu page set to obtain a primary menu page set;
acquiring a primary menu ID of a primary menu in the primary menu page set, traversing the initial menu page set according to the primary menu ID to obtain a secondary menu page set, and continuing traversing the initial menu page set according to the secondary menu ID of a secondary menu in the secondary menu page set until a corresponding menu page cannot be queried to obtain a multi-level menu page set;
And carrying out layered integration on the primary menu page set, the secondary menu page set and the multi-level menu page set to obtain a menu page set.
3. The method for managing Web control elements according to claim 1, wherein the analyzing the HTML source code according to the unique number of the Web control to obtain the control positioning path corresponding to the Web control comprises:
analyzing the HTML source codes to obtain HTML source code body parts;
searching Web control source codes with control element marks from the HTML source code body part;
and inquiring the Web control source codes according to the unique numbers of the Web controls to obtain control positioning paths corresponding to each Web control.
4. The Web control element management method according to claim 1, wherein the identifying the Web control of each menu page in the set of menu pages according to the image recognition algorithm comprises:
extracting a global feature vector of each icon in each menu page;
calculating the global similarity of the global feature vector and the global feature vector of a preset Web control template image;
extracting local feature vectors of icons with global similarity higher than a first preset threshold value;
And calculating the local similarity of the local feature vector and the local feature vector of the preset Web control template image, and taking a menu page element corresponding to an icon with the local similarity higher than a second preset threshold value as a Web control.
5. The method for managing Web control elements according to claim 1, wherein the uniquely marking the Web control to obtain a Web control unique number includes:
searching a menu page set position of a menu page where the Web control is located in the menu page set, and generating a Web control large number according to the menu page set position;
searching a menu page position of the Web control in a menu page where the Web control is located, and generating a Web control small number according to the menu page position;
and combining the large number of the Web control with the small number of the Web control to obtain the unique number of the Web control.
6. The Web control element management method of claim 1, wherein the verifying the control positioning path comprises:
traversing the Web control data in the HTML source code by using a preset element positioning mechanism to obtain detailed information of each Web control;
generating an absolute path of each Web control by using an Xpath language according to the detailed information;
Judging whether the absolute path is consistent with a control positioned by the control positioning path;
when the absolute path is consistent with the control positioned by the control positioning path, judging that the control positioning path is successfully checked;
and when the absolute path is inconsistent with the control positioned by the control positioning path, judging that the control positioning path fails to check.
7. The method for managing Web control elements according to claim 1, wherein the step of reading account information in the basic information by using a preset page crawler mechanism includes:
acquiring an IP address of a storage server corresponding to the basic information by using a preset programming language;
screening out a target index address related to the basic information from the storage server corresponding to the basic information by using a webpage analysis algorithm, and storing the target index address into a queue to be grabbed;
grabbing target index addresses from the queue to be grabbed according to a preset searching strategy until the target index addresses meet a preset limit, and stopping grabbing the target index addresses;
and carrying out information analysis on the basic information corresponding to the target index address, and filtering according to the analysis result to obtain account information.
8. A Web control element management apparatus, the apparatus comprising:
the menu acquisition module is used for receiving basic information of the Web system, reading account information in the basic information by using a preset page crawler mechanism, and clicking menus in the Web system one by using a menu traversal algorithm according to the account information to obtain a menu page set;
the positioning path acquisition module is used for identifying the Web control of each menu page in the menu page set according to an image identification algorithm, uniquely marking the Web control to obtain a unique number of the Web control, acquiring the HTML source code of each menu page in the menu page set, and analyzing the HTML source code according to the unique number of the Web control to obtain a control positioning path corresponding to the Web control;
and the positioning path verification module is used for verifying the control positioning path, editing the Web control corresponding to the control positioning path which fails to verify, performing secondary verification on the edited Web control to obtain a verification result, returning to verify the control positioning path when the verification result is failed, editing the Web control corresponding to the control positioning path which fails to verify, performing secondary verification on the edited Web control to obtain a verification result until the verification result is all successful, and storing the Web control and the control positioning path into a preset database when the verification result is successful.
9. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores computer program instructions executable by the at least one processor to enable the at least one processor to perform the Web control element management method of any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the Web control element management method according to any one of claims 1 to 7.
CN202310413121.8A 2023-04-10 2023-04-10 Web control element management method and device, electronic equipment and medium Pending CN116431950A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310413121.8A CN116431950A (en) 2023-04-10 2023-04-10 Web control element management method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310413121.8A CN116431950A (en) 2023-04-10 2023-04-10 Web control element management method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN116431950A true CN116431950A (en) 2023-07-14

Family

ID=87090475

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310413121.8A Pending CN116431950A (en) 2023-04-10 2023-04-10 Web control element management method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116431950A (en)

Similar Documents

Publication Publication Date Title
US10402163B2 (en) Intelligent data extraction
CN105138312A (en) Table generation method and apparatus
CN109933502B (en) Electronic device, user operation record processing method and storage medium
CN114817968B (en) Method, device and equipment for tracing path of featureless data and storage medium
CN112667878B (en) Webpage text content extraction method and device, electronic equipment and storage medium
CN109190062B (en) Crawling method and device for target corpus data and storage medium
CN112181835A (en) Automatic testing method and device, computer equipment and storage medium
CN112395485A (en) Policy big data mining method and device, computer equipment and storage medium
US9665574B1 (en) Automatically scraping and adding contact information
CN106446123A (en) Webpage verification code element identification method
CN111932413B (en) Case element extraction method, case element extraction device, case element extraction equipment and case element extraction medium
CN112036843A (en) Flow element positioning method, device, equipment and medium based on RPA and AI
CN111414404A (en) Data visualization device and method
CN115186240A (en) Social network user alignment method, device and medium based on relevance information
CN113064984B (en) Intention recognition method, device, electronic equipment and readable storage medium
CN116431950A (en) Web control element management method and device, electronic equipment and medium
CN113051171B (en) Interface testing method, device, equipment and storage medium
CN113221888B (en) License plate number management system test method and device, electronic equipment and storage medium
CN114518993A (en) System performance monitoring method, device, equipment and medium based on business characteristics
CN113724065B (en) Auxiliary collecting method, device, equipment and storage medium based on flow guidance
CN113688049B (en) Retrospective detection method, retrospective detection device, retrospective detection equipment and retrospective detection medium based on input information
CN110618934A (en) Front-end automatic test debugging method and device and computer readable storage medium
CN116226557B (en) Method and device for picking up data to be marked, electronic equipment and storage medium
CN113486266B (en) Page label adding method, device, equipment and storage medium
CN115242638B (en) Feasible touch screening method and device, electronic equipment and storage medium

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