Webpage element positioning method and device and related equipment

By acquiring structured and visual data of web pages, performing visual layout analysis and DOM tree analysis, establishing a two-way mapping relationship, and using a large language model for multimodal data reasoning, the stability and accuracy problems of traditional web page element positioning methods under dynamic rendering and iterative redesign are solved, achieving efficient web page element positioning.

CN123158013APending Publication Date: 2026-11-24BEIJING TAIXIN TIANCHENG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611381112.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies rely excessively on the DOM structure for locating web page elements, making them unsuitable for dynamic front-end rendering. This leads to interruptions in automated processes during web page iterations and redesigns, resulting in high maintenance costs.

Method used

By acquiring the structured and visual data of the target webpage, visual layout parsing and DOM tree parsing are performed to establish a bidirectional mapping relationship between visual regions and nodes. Furthermore, multimodal data reasoning is conducted using a large language model to determine the target elements and their corresponding target nodes.

Benefits of technology

It enables stable and accurate positioning of web page elements in dynamic rendering and iterative redesign scenarios, reduces dependence on fixed DOM structures, lowers maintenance costs, and improves the stability and accuracy of automated positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123158013A_ABST
    Figure CN123158013A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, and related equipment for locating web page elements. The method acquires structured data and a rendered screenshot of the target web page; performs visual layout analysis on the screenshot to obtain visual regions and layout topology information; parses the document object model tree to obtain a dataset of effective nodes; establishes a bidirectional mapping relationship between visual regions and nodes based on a unified coordinate system; inputs multimodal data including layout topology information, node features, and text content into a large language model to infer the business roles of each visual region and corresponding node, determine the target element and its corresponding target node, and obtain the element location result. This invention eliminates the dependence on a fixed document object model structure, can distinguish between core business elements and redundant interference elements, and can stably locate web page elements even in page iteration and redesign scenarios, making it widely applicable to web page automation scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a method, apparatus and related equipment for locating web page elements. Background Technology

[0002] With the rapid development of internet technology and front-end engineering, web pages have become the core carrier for information dissemination, business processing, and data interaction. Automated applications surrounding web pages, such as web data collection, Robotic Process Automation (RPA), automated testing, and emerging AI browser agents, are continuously expanding in scale, placing increasingly higher demands on the accuracy, stability, and automation of web page element location. Currently, mainstream web page element location technologies primarily rely on forward retrieval schemes based on the Document Object Model (DOM), such as XPath, CSS selector positioning, and Playwright Locator positioning. Their core logic is to forward retrieve elements based on the structured features of the web page source code, locating target web page elements by matching static parameters such as tag identifiers, class names, tag levels, text content, and node attributes.

[0003] However, with the widespread use of front-end frameworks such as React and Vue, dynamic rendering of web pages, Shadow DOM, Canvas rendering, dynamic random style class names, and iterative redesign of page layouts have become the norm. Traditional positioning solutions rely heavily on fixed DOM levels, tag attributes, and CSS class names. Minor changes to the front-end page, framework re-rendering, or random generation of style class names can cause XPath and CSS selectors to fail directly, interrupting the automated process and requiring manual re-adaptation of rules, resulting in extremely high maintenance costs. Summary of the Invention

[0004] The present invention provides a method, apparatus and related equipment for locating web page elements, which aims to solve the technical problem that the traditional web page element locating method in the prior art relies too much on the DOM structure and cannot adapt to the dynamic rendering of the front end.

[0005] In a first aspect, embodiments of the present invention provide a method for locating web page elements, comprising: Obtain structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. Visual layout analysis is performed on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area; The document object model tree is parsed to obtain a dataset of valid nodes; A bidirectional mapping relationship is established between the visual region and the nodes in the effective node dataset based on a unified coordinate system. Multimodal data, including the layout topology information, node features, and text content, is input into a large language model. The large language model is used to infer the business roles of each visual region and its corresponding node, determine the target element and its corresponding target node, and obtain the element location result of the target webpage.

[0006] Secondly, embodiments of the present invention provide a webpage element positioning device, comprising: The acquisition module is used to acquire the structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. The layout parsing module is used to perform visual layout parsing on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area. The model tree parsing module is used to parse the document object model tree to obtain a valid node dataset; The relationship building module is used to establish a bidirectional mapping relationship between the visual region and the nodes in the effective node dataset based on a unified coordinate system. The positioning module is used to input multimodal data, including the layout topology information, the node features and text content, into a large language model, and use the large language model to infer the business roles of each visual region and corresponding node, determine the target element and its corresponding target node, and obtain the element positioning result of the target webpage.

[0007] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the webpage element positioning method described in the first aspect.

[0008] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the webpage element positioning method described in the first aspect.

[0009] This invention provides a method, apparatus, and related equipment for locating web page elements. The method acquires structured data and a rendered screenshot of the target web page; performs visual layout analysis on the screenshot to obtain visual regions and layout topology information; parses the document object model tree to obtain a dataset of effective nodes; establishes a bidirectional mapping relationship between visual regions and nodes based on a unified coordinate system; inputs multimodal data including layout topology information, node features, and text content into a large language model to infer the business roles of each visual region and corresponding node, determine the target element and its corresponding target node, and obtain the element location result. This invention eliminates the dependence on a fixed document object model structure, can distinguish between core business elements and redundant interference elements, and can stably locate web page elements even in page iteration and redesign scenarios, making it widely applicable to web page automation scenarios. Attached Figure Description

[0010] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a flowchart illustrating an embodiment of the webpage element positioning method provided by the present invention. Figure 2 This is a schematic block diagram of a webpage element positioning device provided in an embodiment of the present invention. Detailed Implementation

[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0013] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0014] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0015] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0016] Please see Figure 1 This is a flowchart illustrating a webpage element positioning method provided in an embodiment of the present invention, which includes steps S110 to S150.

[0017] Step S110: Obtain the structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. In this embodiment, browser page rendering and simultaneous dual-source data acquisition are employed. Specifically, the target webpage is first loaded and fully rendered by a browser. This browser can be a regular graphical interface browser or a headless browser. After the page is fully loaded (including dynamically rendered content from asynchronous scripts), two types of core data are collected synchronously: First, structured data, which is obtained by traversing the complete DOM tree through the Document Object Model (DOM) interface provided by the browser kernel, recording the tag type, text content, node attributes, hierarchy attributes, and style characteristics of all nodes, and obtaining the bounding box coordinates of each node in the viewport through element position acquisition interfaces (such as getBoundingClientRect). Second, visual data, which is obtained by taking a complete screenshot of the rendered page. The screenshot covers the pixel features of the page, the visual size of each element, and the relative position and layout information between elements. For content drawn by Canvas or presented as images on the page, its visual information is also fully preserved in the screenshot, ensuring that the subsequent visual parsing process remains effective for content without a standard DOM structure. In addition, optical character recognition (OCR) can be performed on page screenshots to convert the visually presented text on the page (including image text and Canvas-drawn text) into page text that can be directly processed by large language models, as part of the multimodal data.

[0018] Step S120: Perform visual layout analysis on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area; In this embodiment, visual layout analysis of page screenshots can be achieved using a computer vision model. The computer vision model can employ object detection models, semantic segmentation models, or document layout analysis models to perform global feature analysis on the webpage screenshot, completing visual region segmentation and layout deconstruction of the page, and automatically identifying and dividing functional areas of the page. Visual regions may include, for example, the page header area, navigation bar area, title area, publication time area, main content area, image area, advertising area, button interaction area, attachment download area, and bottom recommendation area. The analysis result outputs a structured page visual layout topology, recording the pixel coordinates, size, visual weight of each visual region, and the relative hierarchical relationship between regions, thereby simulating the visual cognitive process of human users regarding the overall layout of a webpage.

[0019] Step S130: Parse the document object model tree to obtain a valid node dataset; In this embodiment, the process of parsing the DOM tree to obtain a valid node dataset is a lightweight parsing and noise reduction process: invalid nodes in the DOM tree are filtered out. Invalid nodes include, for example, blank nodes containing only whitespace characters, hidden nodes that are not actually displayed because their styles are set to invisible (e.g., display property is none, visibility property is hidden), and redundant style nodes that only carry decorative styles. Each filtered valid node is bound with a unique identifier (e.g., node path or custom number), text content, tag attributes, screen coordinates, and hierarchical position information to form a standardized DOM node dataset, providing structured support for subsequent cross-modal mapping.

[0020] In one embodiment, the noise reduction filtering rules for DOM tree parsing may include: removing text nodes containing only whitespace characters, removing hidden nodes that are invisible due to style settings, and removing redundant style nodes that are only used for decoration and do not contain semantic information; for each valid node retained, a unique identifier (e.g., an auto-incrementing number, node path, or its hash value), text content, tag attributes, screen coordinates (e.g., coordinate bounding box), and hierarchical position information (e.g., node depth, parent node identifier) ​​are bound together, thereby forming a standardized DOM node dataset with a unified structure and complete fields. Using the above technical solution significantly reduces the size and noise of the DOM data, reduces the data processing volume for subsequent cross-modal mapping and large language model inference, while ensuring the integrity of node information and improving the matching efficiency and accuracy of bidirectional mapping.

[0021] Step S140: Establish a bidirectional mapping relationship between the visual region and the nodes in the effective node dataset based on a unified coordinate system; In this embodiment, the unified coordinate system can be constructed based on the pixel coordinate system of the browser viewport, and the bounding boxes of the DOM nodes can be converted to coordinates that are aligned with the page frame. Figure 1 In a consistent pixel coordinate system, the mapping relationship between the visual pixel coordinate system and the DOM node coordinate system can be pre-defined, thereby achieving alignment and fusion of the two coordinate systems. Based on this, establishing a bidirectional mapping relationship between the visual region and the DOM node enables bidirectional associative retrieval of corresponding DOM nodes from the visual region and vice versa.

[0022] In one embodiment, establishing a bidirectional mapping relationship between the visual regions and nodes in the effective node dataset based on a unified coordinate system includes: matching nodes within the pixel coordinate range based on the pixel coordinates of each visual region; binding each visual region to the matched nodes one by one by combining the text content and size features of the matched nodes, forming association data between visual regions and structural nodes. The association data supports retrieving nodes from visual regions and retrieving visual regions from nodes. Specifically, based on the pixel coordinates of each visual region, the intersection operation is performed between the coordinate rectangle of the visual region and the coordinate bounding box of each DOM node, and nodes whose bounding boxes fall within or partially fall within the coordinate range are selected as candidate nodes; then, combining the text content of the candidate nodes with the text similarity of the visual object (e.g., comparing OCR text or region text with node text) and the consistency check between the size of the candidate nodes and the size of the visual object, the node that best matches the visual object is determined from the candidate nodes, completing the one-to-one binding of the visual object and the DOM node, and forming "visual region-structural node" association data. This associated data can support both searching based on visual regions as indexes and returning all bound DOM nodes, and searching based on DOM nodes as indexes and returning the visual region to which the node belongs and its layout attributes, achieving true bidirectional associative retrieval. This technical solution breaks down the semantic barriers between image visual information and code structure information, overcoming the limitation of traditional techniques that can only derive visual representation from the DOM forward. It provides core foundational support for visual reverse compensation localization and cross-modal fusion reasoning, enabling retrieval and recovery of information from one modality when it is missing or invalid.

[0023] Step S150: Input multimodal data including the layout topology information, the node features and text content into the large language model, and infer the business roles of each visual region and corresponding node through the large language model to determine the target element and its corresponding target node, thereby obtaining the element location result of the target webpage.

[0024] In this embodiment, when multimodal data is input into the large language model for business role reasoning, the input multimodal data includes, for example, visual layout topology (coordinates, size, visual weight, and relative hierarchical relationships of each visual region), page text obtained by OCR recognition, DOM node summaries (structured information such as node labels, text, and attributes), and descriptions of relative regional positions. The large language model can be a general-purpose large language model based on the Transformer architecture or a multimodal large language model. It can be deployed on a local device or call cloud-based large language model services through an application programming interface. This application does not specifically limit this. The inference process guides the model through customized prompts for global page semantic understanding and element role classification. The model goes beyond recognizing physical attributes like tags and styles; instead, based on the overall business scenario of the page, it infers the business role attributes of each visual area and its corresponding DOM node, such as title, publication time, body text, buttons, download links, tables, navigation bars, advertising areas, and attachment areas. It automatically distinguishes core business elements from redundant and distracting elements like advertisements and recommendations, and outputs standardized element location mapping results. For example, it outputs the business role, the visual area it belongs to, the unique identifier of its corresponding DOM node, and its coordinates for each target element in the form of structured data. It should be noted that for scenarios such as Canvas-rendered pages, Shadow DOM encrypted pages, and image-based web pages, since visual layout parsing and OCR recognition do not rely on the standard DOM structure, this implementation scheme can still output reliable visual positioning results and complete the binding of visual areas to nodes when accessible nodes exist.

[0025] In one embodiment, the multimodal data also includes page text obtained by optical character recognition (OCR) of the page screenshot; the layout topology information includes the pixel coordinates, size, visual weight, and relative hierarchy of each visual region. Specifically, OCR can be implemented using a general OCR engine or a text recognition model optimized for web page scenarios. The recognition results cover all visually presented text on the page, including text presented in the form of images, Canvas, etc., which cannot be directly obtained from the DOM tree; the pixel coordinates, size, visual weight, and relative hierarchy in the layout topology information can be directly obtained from the region segmentation results during the visual layout parsing process. The visual weight can be quantified, for example, based on the area ratio of the region, salience (such as color contrast, font size), and other indicators. The multimodal data simultaneously covers three dimensions: visual layout, text content, and structural features, enabling the large language model to obtain a complete cognitive input close to that of humans "viewing web pages and identifying content," especially improving the element recognition ability in scenarios such as image-based web pages and Canvas-rendered pages, and improving the accuracy of business role reasoning under complex pages.

[0026] By combining structured and visual data acquisition, visual layout analysis, DOM structure analysis, bidirectional mapping under a unified coordinate system, and multimodal semantic role reasoning using a large language model, this approach breaks through the limitations of traditional single DOM forward analysis. It enables element positioning to no longer rely heavily on fixed DOM levels, tag attributes, and CSS class names. This allows it to adapt to dynamically rendered pages and special rendering scenarios, and accurately distinguish core business elements from redundant and interfering elements based on the overall business semantics of the page. From an architectural perspective, it solves the technical problems of poor page iteration resistance and weak semantic recognition capabilities of existing technologies, achieving stable, accurate, and universal intelligent positioning of web page elements.

[0027] In one embodiment, the webpage element positioning method provided by this invention further includes: Step S210: In response to the change in the document object model structure of the target webpage causing the document object model-based positioning rules to fail, the target visual area is locked in reverse based on the stable visual layout features of the target webpage. Step S220: Use a unified coordinate system to perform reverse matching between the target visual region and the nodes in the modified document object model tree to complete the repositioning of the target element.

[0028] Specifically, the execution status of existing positioning rules is continuously monitored. When a positioning rule based on the Document Object Model fails to execute, fails verification, or is detected to have undergone significant changes in the page's DOM fingerprint (e.g., the similarity between tag level, class name set, and historical records is below a threshold), the positioning rule is deemed invalid and a visual compensation mechanism is triggered. During the compensation process, invalid DOM structure rules are ignored, and stable visual layout features on the page are reused (e.g., titles are usually located at the top of the page with the largest font size, body text is usually centered, and publication time is usually adjacent to the title). Based on historically accumulated visual layout logic, the target visual area is reverse-locked. Then, using a unified coordinate system, the locked target visual area is reverse-matched with the latest DOM nodes after the current page changes to complete the element repositioning. For pages without a standard DOM structure (e.g., Canvas-rendered pages), the visual area positioning result can be directly used as the final positioning result output. Among these, visual layout features include at least one of the following: the relative position features of the target element, font size features, typographical hierarchy features, and relative layout rules between the target element and related elements. The above technical solution overturns the traditional logic of "forward positioning of visual elements from the DOM structure" and forms a reverse positioning capability that prioritizes visuals and adapts to the structure. It can still stably complete positioning in scenarios where "the DOM changes significantly but the visuals remain unchanged", such as DOM structure reconstruction, randomization of CSS class names, changes in node hierarchy, and minor page redesigns. There is no need to manually rewrite the positioning rules, which completely solves the core problem of positioning failure in dynamic web pages and iterative web pages.

[0029] In one embodiment, the webpage element positioning method provided by this invention further includes: Step S310: Record the parsed data of successful element positioning, classify and accumulate the parsed data according to at least one dimension of site, page type and business scenario, and build a visual template library; Step S320: When parsing web pages that match the visual template library, candidate visual regions are determined based on visual templates in the visual template library.

[0030] In this embodiment, after each successful element location, the page parsing data and location results are automatically recorded, including the page visual layout topology, the business role distribution of each element, visual features, and location coordinates. The recorded data is categorized and consolidated according to dimensions such as site (e.g., website domain), page type (e.g., list page, detail page, form page), or business scenario, constructing a dedicated visual template library. This solidifies the fixed layout rules, element visual features, and role distribution logic of different websites into reusable structured templates. When parsing pages from the same site or of the same type, the current page is preferentially matched with templates in the visual template library, and candidate visual areas are quickly determined based on the successfully matched templates. This embodiment constructs a self-learning iterative system for location capabilities. As usage scenarios accumulate, the visual template library is continuously enriched. Parsing of pages of the same type can skip or simplify some global reasoning steps, achieving self-iteration and self-optimization of the location model, continuously improving location speed and accuracy without manual intervention.

[0031] This method acquires structured data and rendered screenshots of the target webpage; performs visual layout analysis on the screenshots to obtain visual regions and layout topology information; parses the document object model tree to obtain a dataset of effective nodes; establishes a bidirectional mapping relationship between visual regions and nodes based on a unified coordinate system; inputs multimodal data including layout topology information, node features, and text content into a large language model to infer the business roles of each visual region and its corresponding nodes, determine the target elements and their corresponding target nodes, and obtain the element location results. This invention eliminates the dependence on a fixed document object model structure, can distinguish between core business elements and redundant interference elements, and can stably locate webpage elements even in page iteration and redesign scenarios, making it widely applicable to webpage automation scenarios.

[0032] This invention also provides a webpage element positioning device, which is used to execute any of the aforementioned webpage element positioning methods. Specifically, please refer to... Figure 2 , Figure 2 This is a schematic block diagram of a webpage element positioning device provided in an embodiment of the present invention. The webpage element positioning device 100 can be configured in a server.

[0033] like Figure 2As shown, the web page element positioning device 100 includes an acquisition module 110, a layout parsing module 120, a model tree parsing module 130, a relationship construction module 140, and a positioning module 150.

[0034] The acquisition module 110 is used to acquire the structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. The layout parsing module 120 is used to perform visual layout parsing on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area. The model tree parsing module 130 is used to parse the document object model tree to obtain a valid node dataset; The relationship building module 140 is used to establish a bidirectional mapping relationship between the visual region and the nodes in the effective node dataset based on a unified coordinate system. The positioning module 150 is used to input multimodal data including the layout topology information, the node features and text content into a large language model, and use the large language model to infer the business roles of each visual region and corresponding node, determine the target element and its corresponding target node, and obtain the element positioning result of the target webpage.

[0035] In one embodiment, the relationship building module 140 includes: A matching unit is used to match nodes within the range of the pixel coordinates, based on the pixel coordinates of each of the visual regions. The node binding unit is used to bind each visual region to the corresponding matching node based on the text content and size characteristics of the matched node, forming association data between the visual region and the structural node. The association data supports retrieving the node from the visual region and retrieving the visual region from the node.

[0036] In one embodiment, the model tree parsing module 130 includes: A filtering unit is used to filter invalid nodes in the document object model tree, wherein the invalid nodes include at least one of blank nodes, hidden nodes, and redundant style nodes; The information binding unit is used to bind corresponding node information to each node obtained after filtering. The node information includes a unique identifier, text content, tag attributes, screen coordinates, and hierarchical position information.

[0037] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the webpage element positioning method as described above.

[0038] In another embodiment of the invention, a computer-readable storage medium is provided. This computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the webpage element positioning method as described above.

[0039] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.

[0040] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Units with the same function may be grouped into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, or it may be an electrical, mechanical, or other form of connection.

[0041] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.

[0042] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0043] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks.

[0044] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for locating web page elements, characterized in that, include: Obtain structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. Visual layout analysis is performed on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area; The document object model tree is parsed to obtain a dataset of valid nodes; A bidirectional mapping relationship is established between the visual region and the nodes in the effective node dataset based on a unified coordinate system. Multimodal data, including the layout topology information, node features, and text content, is input into a large language model. The large language model is used to infer the business roles of each visual region and its corresponding node, determine the target element and its corresponding target node, and obtain the element location result of the target webpage.

2. The webpage element positioning method as described in claim 1, characterized in that, The step of establishing a bidirectional mapping relationship between the visual region and the nodes in the effective node dataset based on a unified coordinate system includes: Based on the pixel coordinates of each visual region, nodes within the range of the pixel coordinates are matched; Based on the text content and size characteristics of the matched nodes, each visual region is bound to the matched node to form association data between the visual region and the structural node. The association data supports retrieving the node from the visual region and retrieving the visual region from the node.

3. The webpage element positioning method as described in claim 1, characterized in that, Also includes: In response to a change in the document object model structure of the target webpage causing the document object model-based positioning rules to fail, the target visual region is locked in reverse based on the stable visual layout features of the target webpage. By using the unified coordinate system, the target visual region is reverse-matched with the nodes in the modified document object model tree to complete the repositioning of the target element.

4. The webpage element positioning method as described in claim 3, characterized in that, The visual layout features include at least one of the following: the relative position features of the target elements, font size features, typographic hierarchy features, and relative layout rules between the target elements and related elements.

5. The webpage element positioning method as described in claim 1, characterized in that, The process of parsing the document object model to obtain a valid node dataset includes: Filter out invalid nodes in the document object model tree, wherein invalid nodes include at least one of blank nodes, hidden nodes, and redundant style nodes; Each node obtained after filtering is bound to corresponding node information, which includes a unique identifier, text content, tag attributes, screen coordinates, and hierarchical position information.

6. The webpage element positioning method as described in claim 1, characterized in that, The multimodal data also includes the page text obtained by optical character recognition of the page screenshot; the layout topology information includes the pixel coordinates, size, visual weight and relative hierarchical relationship of each visual region.

7. The webpage element positioning method as described in claim 1, characterized in that, Also includes: Record the parsed data of successfully located elements, classify and accumulate the parsed data according to at least one dimension of site, page type and business scenario, and build a visual template library; When parsing web pages that match the visual template library, candidate visual regions are determined primarily based on visual templates in the visual template library.

8. A webpage element positioning device, characterized in that, include: The acquisition module is used to acquire the structured data and visual data of the target webpage. The structured data includes the document object model tree of the target webpage and the node features of each node. The visual data includes a screenshot of the rendered page of the target webpage. The layout parsing module is used to perform visual layout parsing on the page screenshot to obtain multiple visual areas of the target webpage and the layout topology information of each visual area. The model tree parsing module is used to parse the document object model tree to obtain a valid node dataset; The relationship building module is used to establish a bidirectional mapping relationship between the visual region and the nodes in the effective node dataset based on a unified coordinate system. The positioning module is used to input multimodal data, including the layout topology information, the node features and text content, into a large language model, and use the large language model to infer the business roles of each visual region and corresponding node, determine the target element and its corresponding target node, and obtain the element positioning result of the target webpage.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the webpage element positioning method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the web page element positioning method as described in any one of claims 1 to 7.