Positioning method, device, equipment, medium and product

By obtaining the feature information of page elements and using the target model to predict their location in the source code file, it solves the problem that users find it difficult to accurately locate the source code, improves debugging and maintenance efficiency, and enhances the user experience.

CN120353529APending Publication Date: 2025-07-22BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510421595.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the page displayed by the browser, it is difficult for users to accurately locate the source code corresponding to the element through the compiled code, resulting in inefficient debugging and maintenance.

Method used

By obtaining feature information of page elements, such as CSS style and DOM structure, the target model is used to predict its position in the source code file, and automatic positioning is achieved.

Benefits of technology

Improves efficiency during debugging and maintenance, enhances user experience, especially in componentized front-end objects to better understand component functions and dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353529A_ABST
    Figure CN120353529A_ABST
Patent Text Reader

Abstract

The invention discloses a positioning method and device, equipment, a medium and a product in the technical field of computers, and the method comprises the steps: for any element in a page in a display state, in response to detection of a selection operation triggered for the element, obtaining feature information of the element, so as to enable the feature information to describe a state of the element presented in the page; the feature information is sent to a target model, so that the target model can predict the position of a source code corresponding to the element in a source code file corresponding to the page according to the feature information subsequently, and position information is obtained and fed back; the position information is sent to the source code file, so that the position information can indicate the position of the source code corresponding to the element in the source code file, and therefore, the source code corresponding to the element in the source code file can be automatically positioned, and user requirements under some scenes (such as a debugging scene or a maintenance scene) can be better met; and thus, the user experience can be better improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a positioning method, device, equipment, medium, and product. Background Art

[0002] For any page displayed by a browser, a user may have the following requirements: for any element (such as a text box, button, etc.) on the page, determine the position of the source code corresponding to the element in the source code file manually written by relevant personnel. Summary of the Invention

[0003] To solve the above technical problems, this application provides a positioning method, device, equipment, medium, and product.

[0004] To achieve the above object, the technical solutions provided in this application are as follows:

[0005] This application provides a positioning method, which includes: for any element on a page in a display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element, where the feature information describes the state presented by the element on the page; send the feature information to a target model, where the target model is obtained by learning the source code file corresponding to the page, the source code file includes the source code corresponding to the element, and the element is implemented using the source code corresponding to the element; receive the position information predicted by the target model for the feature information, where the position information indicates the position of the source code corresponding to the element in the source code file.

[0006] In a possible implementation manner, the process of determining the target model includes: obtaining the source code file, at least one piece of feature information, and the mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file, where different pieces of feature information in the at least one piece of feature information describe different elements; constructing training data according to the mapping relationship, where the training data indicates the mapping relationship; and training the target model using the training data.

[0007] In a possible implementation manner, the process of obtaining the at least one piece of feature information includes: compiling the source code file to obtain a compiled file, where the compiled file indicates the feature information of different elements on the page; and determining the at least one piece of feature information according to the compiled file.

[0008] In a possible implementation manner, the source code file includes code blocks of at least one component, and this element is implemented by using the code blocks of one or more of the components; the process of determining the target model includes: obtaining the source code file and the description information of each of the at least one component, and the description information of each component respectively indicates the characteristics of each component; according to the positions of the code blocks of each component in the source code file, respectively determine the positions of the description information of each component in the source code file; according to the positions of the description information of each component in the source code file, add the description information of each component to the source code file to obtain an added file; construct training data according to the added file; use the training data to train the target model.

[0009] In a possible implementation manner, for any one of the at least one component, the description information of this component is obtained by analyzing the code blocks of this component.

[0010] In a possible implementation manner, after receiving the position information predicted by the target model for the feature information, the method further includes: in response to detecting that the feedback information provided for the position information indicates that the position information is inaccurate, sending the feedback information to the target model, and the target model is used to be updated according to the feedback information.

[0011] In a possible implementation manner, the page belongs to a target object, and the target object is an application program or a web page; the target model is obtained by learning all the source code files in the project file of the target object.

[0012] In a possible implementation manner, the method is applied to a browser plug-in; for any element in a page in a display state, in response to detecting a selection operation triggered for this element, obtaining the feature information of this element includes: when the browser plug-in is in an active state, for any element in the page in the display state, in response to detecting a selection operation triggered for this element, obtaining the feature information of this element.

[0013] In a possible implementation manner, after receiving the position information predicted by the target model for the feature information, the method further includes: opening a code editor through the browser plug-in, displaying the source code file in the code editor, and highlighting the code indicated by the position information in the source code file in the code editor.

[0014] The present application provides a positioning device, including: an acquisition unit, configured to, for any element in a page in a display state, in response to detecting a selection operation triggered for the element, acquire feature information of the element, where the feature information describes a state in which the element is presented in the page; a sending unit, configured to send the feature information to a target model, where the target model is obtained by learning a source code file corresponding to the page, the source code file includes source code corresponding to the element, and the element is implemented by using the source code corresponding to the element; a receiving unit, configured to receive position information predicted by the target model for the feature information, where the position information indicates a position where the source code corresponding to the element is located in the source code file.

[0015] In a possible implementation manner, the positioning device is a browser plugin; the acquisition unit is specifically configured to: when the positioning device is in an active state, for any element in the page in the display state, in response to detecting a selection operation triggered for the element, acquire feature information of the element.

[0016] The present application provides an electronic device, where the device includes: a processor and a memory; the memory is configured to store instructions or computer programs; the processor is configured to execute the instructions or computer programs in the memory so that the electronic device executes the positioning method provided by the present application.

[0017] The present application provides a computer-readable medium, where instructions or computer programs are stored in the computer-readable medium, and when the instructions or computer programs run on a device, the device is caused to execute the positioning method provided by the present application.

[0018] The present application provides a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for executing the positioning method provided by the present application.

[0019] Compared with the related art, the present application has at least the following advantages:

[0020] In the technical solution provided by this application, for any element on a page in the display state, in response to detecting a selection operation triggered for the element, the feature information of the element is obtained, so that the feature information describes the state presented by the element on the page, such as information like Cascading Style Sheets (CSS) styles, text, Document Object Model (DOM) structures, etc., so that the feature information can represent some characteristics of the element; then the feature information is sent to a target model (such as a large model), so that subsequently, based on the feature information, the target model can predict and feedback the position information of the position where the source code corresponding to the element is located in the source code file corresponding to the page, so that the position information can indicate the position where the source code corresponding to the element is located in the source code file, so that the position information can better indicate which position in the source code file the element is implemented by the source code at that position, so that it is possible to automatically locate the source code corresponding to the element in the source code file, which is beneficial to better meet the user needs in some scenarios (such as debugging scenarios or maintenance scenarios), and further beneficial to better improve the user experience. Among them, since the target model is obtained by learning the source code file, so that the target model can better learn how to locate the source code corresponding to each element from the source code file, so that the target model has better positioning performance, and further makes the automatic positioning process implemented based on the target model present a better effect to better meet the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of this application or the related art, the following will briefly introduce the drawings required for use in the description of the embodiments or the related art. Obviously, the drawings described below are only some embodiments recorded in this application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0022] Figure 1 It is a flowchart of a positioning method provided by an embodiment of this application;

[0023] Figure 2 It is a schematic diagram of the working principle of a browser plugin with the function of positioning from page elements to source code files provided by an embodiment of this application;

[0024] Figure 3 It is a schematic diagram of a positioning process provided by an embodiment of this application;

[0025] Figure 4 It is a schematic diagram of the structure of a positioning device provided by an embodiment of this application;

[0026] Figure 5 A structural schematic diagram of an electronic device provided by an embodiment of the present application. Specific implementation manners

[0027] After research, it is found that in some scenarios (such as debugging or maintenance scenarios), for any page displayed by a browser, a user can use the Elements panel in the built-in Web developer tools of the browser to determine the compiled code corresponding to any element (such as elements like text boxes and buttons) in the page, such as HyperText Markup Language (HTML) code, so that the compiled code can represent some characteristics of the element to a certain extent (such as CSS styles, DOM structures, etc.). In this way, it is possible to locate the compiled code corresponding to the element with the help of the Elements panel. However, since the compiled code is obtained by compiling a source code file manually written by relevant personnel, the readability of the compiled code is much worse than that of the source code file, which makes it difficult for users to understand the compiled code. As a result, it is difficult for users to analyze the information they want to know (such as the functions of each component in a componentized front-end application and the dependency relationships between different components, etc.) from the compiled code. Thus, users need to manually search for the source code corresponding to the element in the source code file, resulting in relatively low efficiency and affecting the user experience.

[0028] It should be noted that the above componentization means: disassembling a front-end object (such as an application or a web page) into reusable, independent, and well-encapsulated modules (such as code blocks, etc.), so that each module can be used as a component with its own business logic and User Interface (UI) presentation, so that the front-end object is implemented by using multiple components. Therefore, componentization is beneficial to improving development efficiency, enhancing code reusability, and reducing maintenance costs, etc. In addition, in any componentized front-end object, components are used as the smallest business units to complete some functional logic and UI rendering tasks, so that in some scenarios (such as debugging scenarios, maintenance scenarios, optimization scenarios, testing scenarios, etc.), there are the following requirements: locating from page elements to the source code file of the front-end object to better understand the functions of each component and the dependency relationships between different components, etc.

[0029] Based on the above research, in order to better meet the above requirements, the present application provides an automatic positioning method, which includes: for any element in a page in the display state, in response to detecting a selection operation triggered for the element, obtaining the feature information of the element, so that the feature information describes the state presented by the element in the page, such as CSS style, text, DOM structure and other information, so that the feature information can represent some characteristics of the element; then sending the feature information to a target model (such as a large model), so that subsequently the target model can, based on the feature information, predict the position of the source code corresponding to the element in the source code file corresponding to the page and feedback the position information, so that the position information can indicate the position of the source code corresponding to the element in the source code file, so that the position information can better indicate which position in the source code file the element is implemented by the source code at that position, so as to realize automatically positioning the source code corresponding to the element in the source code file, which is beneficial to better meet the user needs in some scenarios (such as debugging scenarios or maintenance scenarios), and further beneficial to better improving the user experience. Among them, since the target model is obtained by learning the source code file, so that the target model can better learn how to locate the source code corresponding to each element from the source code file, so that the target model has better positioning performance, and further making the automatic positioning process implemented based on the target model present a better effect to better meet the user experience.

[0030] In addition, the present application does not limit the execution subject of the positioning method. For example, the method can be applied to a terminal device. Another example is that the method can also be implemented by means of the data interaction process between the terminal device and the server. Among them, the terminal device can be a smart phone, a computer, a personal digital assistant (PDA), a tablet computer, etc. The server can be an independent server, a cluster server or a cloud server.

[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0032] To better understand the technical solution provided by the present application, the positioning method provided by the present application will be described below in conjunction with some drawings. As Figure 1 shown, the positioning method provided by the embodiment of the present application includes S1-S3 below.

[0033] S1: For any element on a page in a display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element, where the feature information describes the state in which the element is presented on the page.

[0034] Among them, the above-mentioned "page in a display state" refers to a page that is being displayed and requires source code location processing (such as Figure 2 the web page shown); moreover, this application does not limit the implementation manner of the page. For example, it can be implemented using any type of page, such as a page displayed by a browser. Additionally, for any element displayed on the page (such as Figure 2 element 1 to element 4 shown), this application does not limit the implementation manner of the element. For example, it can be implemented using any type of page element, such as button, text box, table, etc.

[0035] The selection operation refers to an operation triggered for the above-mentioned element that can indicate the selection of the element (such as Figure 2 the operation of clicking on element 3 shown); moreover, this application does not limit the implementation manner of the selection operation. For example, it can be implemented using any operation that can select a page element, such as a click operation. It should be noted that Figure 2 the element selection process shown is triggered by clicking the button in the upper left corner of the development tool page shown in Figure 2 .

[0036] In addition, for the selected element, the feature information of the element can describe the state in which the element is presented on the page; moreover, this application does not limit the feature information. For example, the feature information can include CSS styles, text, DOM structures, etc. information so that the feature information can represent some characteristics of the element, such as visualization characteristics. Also, in some scenarios, the feature information can include the compiled code corresponding to the element so that the feature information can better represent the characteristics of the element.

[0037] In addition, this application does not limit the method for obtaining the above-mentioned feature information. For example, it can be implemented using any method that can obtain the feature information of a page element, such as by means of the Elements panel shown in the development tool page in Figure 2 .

[0038] S2: Send the above-mentioned feature information to a target model, where the target model is obtained by learning the source code file corresponding to the above-mentioned page, and the source code file includes the source code corresponding to the above-mentioned element, and the element is implemented using the source code corresponding to the element.

[0039] Among them, the target model is a machine learning model, and this model has the following functions: based on the feature information of a certain element, predict the position of the source code corresponding to this element in the source code file. It should be noted that the implementation manner of this target model is not limited in this application. For example, it can adopt any machine learning model that can implement the foregoing prediction function, such as any large model for implementation. In addition, the implementation manner of this large model is not limited in this application. For example, it can adopt any version of the Generative Pre-trained Transformer (GPT) or DeepSeek for implementation.

[0040] The above-mentioned "source code file corresponding to the page" refers to the source code file involved in implementing this page, so that this file includes the source code corresponding to each element in this page, so that the target model obtained by learning this file can better predict the position of the source code corresponding to each element in this page in this file. It can be seen that this page is implemented using the source code file corresponding to this page. It should be noted that the implementation manner of this learning is not limited in this application. For example, it can adopt any learning method, such as supervised learning or self-supervised learning for implementation.

[0041] In addition, in some scenarios, such as the scenario where the front-end object is implemented in a componentized manner, for any element, the source code corresponding to this element can indicate which component code blocks this element is implemented by, so that the source code corresponding to this element can describe the functions of each component in some components and the dependency relationships between different components in some components, so that users can better understand the implementation manner of this element through the source code corresponding to this element, so as to be able to obtain this element by a certain processing method for the source code corresponding to this element subsequently. It can be seen that this element is obtained by processing the source code corresponding to this element.

[0042] S3: Receive the position information predicted by the target model for the above-mentioned feature information, and this position information indicates the position of the source code corresponding to the above-mentioned element in the source code file.

[0043] Based on the relevant content of the above S1 to S3, it can be known that the automatic positioning solution provided by this application includes: for any element in a page in a display state (such as Figure 2 the web page shown), in response to detecting an operation on this element (such as Figure 2The selection operation triggered by the clicked element 3) shown above is used to obtain the feature information of the element, so that the feature information describes the state of the element presented on the page, such as CSS styles, text, DOM structure, etc. information, so that the feature information can represent some characteristics of the element; then the feature information is sent to the target model (such as a large model), so that subsequently the target model can, based on the feature information, predict and feedback the position information (such as Figure 2 the position information shown above) of the source code corresponding to the element in the source code file corresponding to the page, so that the position information can indicate the position of the source code corresponding to the element in the source code file, so that the position information can better indicate which position of the source code in the source code file the element is implemented with. In this way, it is possible to automatically locate the source code corresponding to the element in the source code file, which is beneficial to better meet the user needs in some scenarios (such as debugging scenarios or maintenance scenarios), and thus beneficial to better improve the user experience. Among them, since the target model is obtained by learning the source code file, so that the target model can better learn how to locate the source code corresponding to each element from the source code file, so that the target model has good positioning performance, and thus the automatic positioning process implemented based on the target model shows a better effect to better meet the user experience.

[0044] It has been found through research that in some scenarios, such as the scenario of using a browser to display a page, in order to better improve the user experience, the present application can implement any implementation manner of the positioning method provided by the present application with the help of a browser plug-in. Based on this, in a possible implementation manner, the positioning method can be applied to a browser plug-in (such as Figure 2 the target plug-in shown above or Figure 3 the browser plug-in shown above), so that subsequently it is possible to more efficiently implement the positioning from the page elements displayed by the browser to the source code file by the plug-in executing the positioning method, which is beneficial to improving the positioning accuracy and efficiency, and thus beneficial to better improving the user experience. It should be noted that the present application does not limit the implementation manner of the plug-in. For example, it can be implemented in any plug-in development manner, such as the JavaScript development manner.

[0045] To better understand the above browser plug-in, the following takes a working principle of the plug-in as an example for description.

[0046] As an example, in a possible implementation, the working principle of the above browser plugin may include: when the plugin is in an active state, for any element on the page in the display state, in response to detecting a selection operation triggered for the element, the plugin first obtains the feature information of the element so that the feature information can describe the state presented by the element on the page; then the plugin sends the feature information to the target model so that the target model can, based on the feature information, predict the position of the source code corresponding to the element in the source code file corresponding to the page to obtain position information; then the plugin receives the position information fed back by the target model for the feature information so that the position information can indicate the position of the source code corresponding to the element in the source code file, so that it is possible to obtain the position of the source code corresponding to the element in the source code file without leaving the page being displayed by the browser, which is beneficial to better improving the user experience.

[0047] It should be noted that this application does not limit the implementation manner of the step of "the plugin obtains the feature information of the element". For example, specifically, for any element on the page being displayed on the browser, after the plugin detects a selection operation triggered by the user for the element, the plugin uses the application programming interface (Application Programming Interface, API) of the built-in Web developer tool of the browser to request the feature information of the element, so that the Web developer tool (such as Figure 2 the development tool shown) can obtain the feature information through calling CSS selectors and DOM APIs for feedback, so that the plugin can automatically obtain the feature information of the element by means of the functions already available in the browser itself, thereby reducing the implementation difficulty of the plugin.

[0048] It should also be noted that this application does not limit the communication method between the above browser plugin and the target model. For example, the plugin can use the communication function (runtime.sendMessage) API of the browser to communicate with the target model. It can be seen that for any element on the page being displayed on the browser, after the plugin detects a selection operation triggered by the user for the element, the plugin uses the communication function API to send the feature information of the element to the target model, so that the plugin can then use the communication function API to receive the position information predicted by the target model for the feature information.

[0049] Furthermore, it should be noted that this application does not limit the deployment location of the target model. For example, the target model can be deployed in the background server so that the browser plugin deployed in the front-end device can communicate with the target model through a certain method (such as the above communication function API).

[0050] In addition, to better improve the user experience, the present application also provides a possible implementation manner of the positioning method applied to the above browser plug-in. In this manner, the positioning method may include: when the plug-in is in an active state, for any element on the page in the display state, in response to detecting a selection operation triggered for the element, first, the plug-in obtains the feature information of the element; then, the plug-in sends the feature information to the target model, so that the target model can predict the position of the source code corresponding to the element in the source code file corresponding to the page based on the feature information to obtain position information. After the plug-in receives the position information feedback by the target model for the feature information, the plug-in opens a code editor, displays the source code file in the code editor, and highlights the code indicated by the position information in the source code file (that is, the source code corresponding to the element). In this way, it is possible to enable the user to view the source code corresponding to the element from the source code file without leaving the page being displayed by the browser, which is beneficial to better improving the user experience.

[0051] It should be noted that the above "highlight" can prominently display the code indicated by the above position information in the source code file, so that the display state of the code is different from the display states of other codes in the source code file, enabling the user to more easily see the code, which is beneficial to better improving the user experience. In addition, the present application does not limit the implementation manner of the "highlight". For example, it can adopt any manner capable of highlighting the code, such as Figure 3 implementing it in the manner of highlighting as shown. In addition, Figure 3 the character "X" shown is only used to represent the content recorded in the source code file and has no actual meaning.

[0052] It should also be noted that the above code editor is a code development tool completely independent of the browser, and the code editor can at least provide the following functions to the user: opening the source code file and editing the source code file. In addition, the present application does not limit the implementation manner of the code editor. For example, it can adopt any development tool with source code editing functions, such as a cross-platform source code editor for writing Web and cloud applications (VisualStudio Code, VSCode), or a development tool for an integrated development environment suitable for JavaScript and related technologies (WebStorm) for implementation.

[0053] It should be further noted that the present application does not limit the above "opening the code editor through the plug-in". For example, it can adopt any method capable of opening the code editor from the browser plug-in for implementation.

[0054] It has been found that for a componentized front-end object (such as an application), in order to better improve the development experience of the front-end object, all source code files in the project file of the front-end object can be used to train a target model, so that the trained target model can better learn the mapping relationship between the code blocks of each component and different page elements in these source code files, thereby enabling the target model to have better positioning performance. Among them, the project file refers to various documents and resources generated during the development of the front-end object, so that the project file includes source code files, resource files, configuration files, etc., so that the front-end object can be implemented based on the project file.

[0055] Based on the above research, in a possible implementation manner, when the above-mentioned "page in the display state" belongs to the target object, and the target object is an application or a web page, the source code file corresponding to the page can include all source code files in the project file of the target object, so that the above-mentioned target model can be obtained by learning all source code files in the project file of the target object, so that the target model can learn the mapping relationship between the code blocks of each component and different page elements in these source code files, and further enable the target model to more accurately determine the location of the source code corresponding to the elements on each page in the target object in these source code files, which is beneficial to better improving the user experience under the target object (such as development experience, optimization experience, etc.).

[0056] It should be noted that the above-mentioned target object refers to any componentized front-end object; and this application does not limit the implementation manner of the target object. For example, the target object can be implemented using an application (such as a web version of the application). Another example is that the target object can be implemented using a web page.

[0057] Based on the above two paragraphs, in some scenarios, for any componentized front-end object (such as the above-mentioned target object), if a browser plugin is pre-configured for the front-end object, the user can use the plugin to locate from the page element to the source code file in the front-end object during the use of the front-end object; and the positioning process can specifically include: when the plugin is in the activated state, and a certain page in the front-end object (such as Figure 2 the web page shown) is in the display state, if the plugin detects that the user clicks on a certain element on the page (such as Figure 2If the element 3) shown triggers a selection operation, first the plugin obtains the feature information of the element in a certain way so that the feature information can represent the characteristics presented by the element on the page. Then the plugin sends the feature information to the target model so that the target model can predict the position of the source code corresponding to the element in the source code file based on the feature information to obtain position information. After the plugin receives the position information fed back by the target model, the code editor is opened from the plugin so that the code editor highlights the code indicated by the position information in the source code file while opening the source code file. In this way, it is possible to view the source code corresponding to some page elements in the source code file of the front-end object without leaving the front-end object, which is beneficial for users to better understand the functions of the components involved in the front-end object and the dependencies between different components, and thus is beneficial for better improving the user experience.

[0058] In addition, to better improve the positioning effect, the present application also provides a determination process for the target model, which specifically may include the following steps 11 - step 13.

[0059] Step 11: Obtain the above-mentioned source code file (such as the "source code file corresponding to the page"), at least one piece of feature information, and the mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file. Different pieces of feature information in the at least one piece of feature information describe different elements.

[0060] Among them, the above-mentioned at least one piece of feature information refers to the information obtained in a certain way in advance and used to describe the characteristics of some elements, so that different pieces of feature information in the at least one piece of feature information can describe different elements, so that the training data of the target model can be constructed based on the at least one piece of feature information subsequently.

[0061] In addition, the present application does not limit the acquisition method of the above-mentioned at least one piece of feature information. For example, it can be obtained by manual annotation.

[0062] Again, in some scenarios, the above-mentioned at least one piece of feature information can be obtained by analyzing the associated files of the above-mentioned target object (such as a web application), such as project files, usage documents, expert experience files, etc., so that the at least one piece of feature information can describe the characteristics of some elements described by the associated files. Among them, the associated file is used to describe some characteristics of the target object, such as page element characteristics, etc.; and the present application does not limit the associated file. It should be noted that the present application does not limit the implementation manner of the analysis. For example, it can be implemented using any machine learning model with the analysis function.

[0063] In addition, for the above at least one piece of feature information, the mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file can describe which code blocks in the source code each element described by the at least one piece of feature information corresponds to. It should be noted that the present application does not limit the acquisition method of this mapping relationship. For example, it can be determined by manual annotation.

[0064] For another example, in some scenarios, the above "mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file" can be obtained by analyzing the associated content of the above target object (such as data, project files, usage documents, expert experience, etc. that can describe the corresponding relationship between elements and the source code recorded in the historical processing process), so that this mapping relationship can describe the corresponding relationship between some page elements involved in the target object and the code blocks in the source code file, so as to construct training data for the target model based on this mapping relationship subsequently.

[0065] Step 12: Construct training data according to the mapping relationship between each piece of feature information in the above at least one piece of feature information and each code block in the source code file, and the training data indicates this mapping relationship.

[0066] It should be noted that the present application does not limit the implementation manner of the training data. For example, in some scenarios, the training data may include a large amount of data; and for any piece of data in the training data, this data can be implemented in the form of a binary tuple (feature information of an element, the source code corresponding to the element), so that this data can represent the corresponding relationship between the feature information and the source code, so as to use the position of the source code corresponding to the element in the above source code file as the ground truth subsequently to guide and optimize the positioning process implemented by the target model for this feature information.

[0067] Step 13: Train the target model using the above training data.

[0068] It should be noted that the present application does not limit the implementation manner of the above Step 13. For example, it can be implemented using any method that can realize model training based on training data.

[0069] Based on the relevant content of the above Steps 11 to 13, it can be seen that in some scenarios, the training process of the target model can be realized by using the target model to learn the source code of a large number of components in the source code file, so that the trained model can predict the source code position corresponding to the element indicated by the input feature information according to the input feature information, so that the trained model has better positioning performance.

[0070] It has been found that since the compiled file can to some extent represent the characteristics of some page elements, such as CSS styles, etc., in order to better reduce the difficulty of obtaining the above training data, the present application also provides a process for obtaining the above at least one piece of feature information, which may specifically include: first, compiling the above source code file to obtain a compiled file, and the compiled file indicates the feature information of different elements in the above page; then, based on the compiled file, determining the at least one piece of feature information, so that the at least one piece of feature information can as comprehensively and accurately as possible describe some page elements implemented by using the source code file, so that subsequently, as many high-quality training data as possible can be constructed based on the at least one piece of feature information. Among them, since the at least one piece of feature information is obtained by automatically analyzing the source code file, rather than manually determined by relevant personnel, the process of obtaining the at least one piece of feature information is made simpler, which is conducive to reducing the difficulty and cost of data acquisition.

[0071] It has been found that since the source code file records a large amount of code, it is difficult for the source code file to accurately and comprehensively describe the characteristics of the code blocks of each component, such as the name, function description, properties (props), state (sate), event handling functions, etc. of the component, thus affecting the learning effect of the target model on the source code file.

[0072] Based on the above research, in order to better improve the model learning effect, when the above source code file includes the code blocks of at least one component, for any element in the above page, the element can be implemented by using the code blocks of one or more components, so that the source code corresponding to the element includes the aforementioned "code blocks of one or more components", so that the above target model can locate the "code blocks of one or more components" from the source code file according to the feature information of the element. Therefore, in order to better implement this function, the determination process of the target model may include steps 21-step 25 below.

[0073] Step 21: Obtain the above source code file (such as the "source code file corresponding to the page") and the description information of each component in the above at least one component (such as information on the name, function description, properties, state, event handling functions, expert experience, etc. of the component), and the description information of each component respectively indicates the characteristics of each component.

[0074] Among them, the description information of the i-th component is used to indicate the characteristics of the i-th component (such as characteristics such as the name, function description, properties, state, event handling functions, etc. of the component), so that the "description information of the i-th component" can represent some characteristics described by the code block of the i-th component. i is a positive integer, and i ≤ the number of components in the above at least one component.

[0075] In addition, the present application does not limit the manner of obtaining the above-described description information. For example, it can be implemented by manual annotation.

[0076] Step 22: Determine the positions of the description information of each component in the source code file according to the positions of the code blocks of each component in at least one of the above components in the source code file.

[0077] It should be noted that the present application does not limit the implementation manner of the above Step 22. For example, specifically, it can be: determine the position of the description information of the i-th component in the source code file according to the position of the code block of the i-th component in the source code file, so that the distance between the description information and the code block in the source code file is less than a preset distance threshold, so that the description information can be displayed around (such as above) the code block. Wherein, i is a positive integer, and i ≤ the number of components in at least one of the above components.

[0078] Step 23: Add the description information of each component to the above source code file according to the positions of the description information of each component in the source code file to obtain an added file.

[0079] It should be noted that the present application does not limit the implementation manner of the above "addition". For example, it can be implemented by using any one of structured annotations (such as JSDoc-style annotations), TypeScript type definitions, custom attributes, or specific code structures, so as to ensure that the added content will not interfere with the code blocks of the components, so that it can be ensured that the added content will not affect the normal operation of the components, so that it is possible to achieve that the file obtained by compiling the above added file is the same as the file obtained by compiling the above source code file.

[0080] Step 24: Construct training data based on the added file.

[0081] It should be noted that the present application does not limit the implementation manner of the above Step 24. For example, it is similar to the process of constructing training data shown in the above Steps 11 to 12.

[0082] Step 25: Train the target model using the training data.

[0083] It should be noted that for the relevant content of the above Step 25, please refer to the relevant content of the above Step 13.

[0084] Based on the relevant content of the above steps 21 to 25, it can be seen that in some scenarios, the source code file can be optimized by adding the description information of each component to the source code file, so that the optimized source code file can describe the relevant content of each component (such as code blocks, some characteristics, etc.) more comprehensively and in detail without affecting the functional implementation of each component described by the source code. Furthermore, the target model can better learn this content from the optimized source code file, which is beneficial to better improving the positioning accuracy and efficiency of the target model.

[0085] In addition, in order to better improve flexibility, for any one of the above at least one component, the description information of the component can be obtained by analyzing the code block of the component, so that the description information can represent some characteristics of the component. In this way, it is possible to automatically analyze the description information, effectively overcome the defects caused by manually providing the description information, and thus is beneficial to better reducing the difficulty of data acquisition.

[0086] Furthermore, in order to better improve the positioning effect, the present application also provides a possible implementation manner of the above positioning method. In this manner, the positioning method may further include the following steps: after receiving the position information predicted by the target model for the above feature information, in response to detecting that the feedback information provided for the position information indicates that the position information is inaccurate, sending the feedback information to the target model, and the target model is used to be updated based on the feedback information, so that the updated target model can overcome the inaccurate problem indicated by the feedback information, thereby enabling the updated target model to have better positioning performance. In this way, an automatic learning mechanism can be implemented to improve the positioning accuracy and positioning efficiency.

[0087] It should be noted that the above feedback information refers to the feedback given by the user for the above position information (such as a like or a dislike or providing the correct source code position, etc.), so that the feedback information can indicate whether the position information is accurate and whether adjustment is needed. In addition, when the feedback information indicates that the position information is inaccurate, the feedback information may further include the accurate source code position provided by the user for the currently selected element, so as to better optimize the target model based on the feedback information in the future. Furthermore, the present application does not limit the acquisition method of the feedback information.

[0088] It should also be noted that the present application does not limit the implementation manner of the step of "updating the target model according to the feedback information". For example, it can be implemented by means of any model updating method, such as reinforcement learning. It can be seen that after obtaining the feedback information, methods such as reinforcement learning can be used to realize the self-learning verification and self-enhancement of the model; and the self-learning verification and self-enhancement process can include: using the feedback information as a reward signal, if the feedback information indicates accurate positioning, the reward is 1 and recording the data involved in the current positioning as learning data. However, if the feedback information indicates inaccurate positioning, the reward is -1 and adjusting the output expectation of the target model according to the accurate source code position indicated by the feedback information.

[0089] Based on the relevant content of the above positioning method, it can be known that the automatic positioning scheme provided by the present application, such as Figure 3 shown, has the characteristics shown in ①-⑦ below.

[0090] ① The present application provides a browser plugin that can implement the above automatic positioning scheme, so that when the plugin is in the active state, it allows the user to click on an element on the page, and the plugin obtains the feature information of the clicked element (such as CSS style, text, DOM structure, etc.), and the plugin sends the feature information to a target model (such as a large model), so that the target model can predict the position of the source code corresponding to the element in the source code file based on the feature information to obtain position information. After the plugin receives the position information returned by the target model, the code indicated by the position information in the source code file is highlighted in the code editor (such as VSCode, WebStorm, etc.) opened by the plugin, so as to view the code without leaving the currently displayed page, which is beneficial to improving the user experience.

[0091] ②The target model provided by this application can learn in advance all the source code files involved in a certain front-end object (such as an application or a web page), so that the model can learn the characteristics (such as the structure and function implementation of components) described by the code blocks of a large number of components through a certain method (such as supervised learning or self-supervised learning, etc.), so that the model can better predict the corresponding source code location according to the element feature information it inputs, and then when debugging or maintaining the front-end object, the model can be used to quickly locate from the page elements to the corresponding source code location in the source code file of the front-end object. In addition, by adding some key information (such as the name, function description, attributes, status, event handling functions, expert experience, etc. of the components) to the code blocks of each component in the source code file, this application enables the source code file to more comprehensively, accurately and meticulously describe the characteristics of each component, so that the target model learned based on the source code file has better positioning accuracy and efficiency. In addition, this application can use JSDoc-style comments, TypeScript type definitions, custom attributes or specific code structures to mark these key information (such as Figure 3 the key information shown).

[0092] ③This application optimizes the positioning performance of the target model through the model self-learning verification and enhancement method. Specifically, the browser plugin collects the feedback information provided by the user for the location information already obtained from the target model, so that the feedback information can indicate whether the location information is accurate, etc. So that when it is determined that the location information is inaccurate, the target model can automatically perform parameter update and adjustment according to the feedback information and the above source code file to improve accuracy. In addition, the target model can use the reinforcement learning method to achieve self-enhancement of the model. In addition, when using reinforcement learning to optimize the model, the feedback information can be used as a reward signal. If the feedback information indicates accurate positioning, the reward is 1. If the feedback information indicates inaccurate positioning, the reward is -1 and the output expectation of the target model is adjusted according to the accurate source code location indicated by the feedback information.

[0093] ④The browser plugin provided by this application is developed using JavaScript, so that the plugin can use the API of the built-in Web developer tools of the browser to perform some interactions, such as using CSS selectors to obtain CSS styles, using the API of DOM to obtain the DOM structure, etc., and also enables the plugin to communicate with the target model deployed in the background through the API of the communication function of the browser.

[0094] ⑤ By using the method of having a large model learn the code blocks of each component in the source code file, this application achieves precise positioning from page elements to the source code. This is beneficial for improving the accuracy and efficiency of page element positioning, enabling developers to quickly locate the source code position of components, reducing manual operations, thus helping to lower development costs by reducing the time and cost of debugging and maintaining code, and also facilitating an increase in development efficiency, allowing developers to focus more on the implementation of business logic.

[0095] ⑥ Through the marking method of the key information of components and the self-learning verification mechanism of the model, this application improves the positioning accuracy and efficiency.

[0096] ⑦ This application is based on a browser plugin and a large model to implement page element positioning processing, achieving automatic positioning from page elements to the source code rather than HTML code. This is beneficial for improving the positioning accuracy of page elements, enabling developers to better understand the relevant content of the element with the help of the source code, helping developers better understand the functions and dependencies of some components, and thus facilitating better enhancement of code understanding ability, enabling developers to better carry out development-related matters (such as debugging, maintenance, etc.).

[0097] Based on the positioning method provided by the embodiments of this application, the embodiments of this application also provide a positioning device. The following will be combined with Figure 4 for explanation and illustration. Among them, Figure 4 is a schematic structural diagram of a positioning device provided by the embodiments of this application. It should be noted that for the technical details of the positioning device provided by the embodiments of this application, please refer to the relevant content of the above positioning method.

[0098] As Figure 4 shown, the positioning device 400 provided by the embodiments of this application includes:

[0099] An acquisition unit 401, configured to, for any element in a page in a display state, in response to detecting a selection operation triggered for the element, acquire the feature information of the element, where the feature information describes the state presented by the element in the page;

[0100] A sending unit 402, configured to send the feature information to a target model, where the target model is obtained by learning the source code file corresponding to the page, and the source code file includes the source code corresponding to the element, and the element is implemented by using the source code corresponding to the element;

[0101] A receiving unit 403, configured to receive the position information predicted by the target model for the feature information, where the position information indicates the position where the source code corresponding to the element is located in the source code file.

[0102] In a possible implementation manner, the process of determining the target model includes: obtaining the source code file, at least one piece of feature information, and the mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file, where different pieces of feature information in the at least one piece of feature information describe different elements; constructing training data according to the mapping relationship, where the training data indicates the mapping relationship; and training the target model by using the training data.

[0103] In a possible implementation manner, the process of obtaining the at least one piece of feature information includes: compiling the source code file to obtain a compiled file, where the compiled file indicates the feature information of different elements in the page; and determining the at least one piece of feature information according to the compiled file.

[0104] In a possible implementation manner, the source code file includes code blocks of at least one component, and the element is implemented by using the code blocks of one or more of the components; the process of determining the target model includes: obtaining the source code file and the description information of each of the at least one component, where the description information of each component respectively indicates the features of each component; determining the positions of the description information of each component in the source code file according to the positions of the code blocks of each component in the source code file; adding the description information of each component to the source code file according to the positions of the description information of each component in the source code file to obtain an added file; constructing training data according to the added file; and training the target model by using the training data.

[0105] In a possible implementation manner, for any one of the at least one component, the description information of the component is obtained by analyzing the code block of the component.

[0106] In a possible implementation manner, the sending unit 402 is further configured to: in response to detecting that the feedback information provided for the location information indicates that the location information is inaccurate, send the feedback information to the target model, and the target model is used to be updated according to the feedback information.

[0107] In a possible implementation manner, the page belongs to a target object, and the target object is an application program or a web page; the target model is obtained by learning all the source code files in the project file of the target object.

[0108] In a possible implementation manner, the positioning device 400 is a browser plugin; the obtaining unit 401 is specifically configured to: when the positioning device 400 is in an active state, for any element in the page in the display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element.

[0109] In a possible implementation manner, the positioning device 400 further includes: an opening unit, configured to open a code editor through the browser plugin, display the source code file in the code editor, and highlight the code indicated by the position information in the source code file in the code editor.

[0110] Based on the relevant content of the positioning device 400 above, the working principle of the device 400 includes: for any element in the page in the display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element, so that the feature information describes the state presented by the element in the page, such as CSS style, text, DOM structure and other information, so that the feature information can represent some characteristics of the element; then send the feature information to a target model (such as a large model), so that the target model can subsequently predict and feedback the position information according to the feature information for the position of the source code corresponding to the element in the source code file corresponding to the page, so that the position information can indicate the position of the source code corresponding to the element in the source code file, so that the position information can better indicate which position of the source code in the source code file the element is implemented by, so as to be able to automatically locate the source code corresponding to the element in the source code file, which is beneficial to better meet the user needs in some scenarios (such as debugging scenarios or maintenance scenarios), and thus is beneficial to better improving the user experience. Among them, because the target model is obtained by learning the source code file, so that the target model can better learn how to locate the source code corresponding to each element from the source code file, so that the target model has better positioning performance, and thus the automatic positioning process implemented based on the target model presents a better effect to better meet the user experience.

[0111] In addition, an embodiment of the present application further provides an electronic device, the device includes a processor and a memory: the memory is used to store instructions or computer programs; the processor is used to execute the instructions or computer programs in the memory, so that the electronic device executes any implementation manner of the positioning method provided by the embodiment of the present application.

[0112] See Figure 5, which shows a schematic structural diagram of an electronic device 500 suitable for implementing the embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.

[0113] As Figure 5 shown, the electronic device 500 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 501, which may perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage device 508 into the random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.

[0114] Generally, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 5 shows the electronic device 500 having various devices, it should be understood that it is not required to implement or include all the shown devices. Instead, more or fewer devices may be implemented or included.

[0115] Specifically, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.

[0116] The electronic device provided by the embodiments of the present disclosure and the method provided by the above embodiments belong to the same inventive concept. For technical details not described in detail in this embodiment, reference may be made to the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0117] An embodiment of the present application further provides a computer-readable medium storing instructions or a computer program. When the instructions or the computer program runs on a device, the device is caused to execute any implementation manner of the positioning method provided by the embodiments of the present application.

[0118] It should be noted that the computer-readable medium in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0119] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0120] The above computer-readable medium can be included in the above electronic device; or it can exist separately and not be assembled into the electronic device.

[0121] The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can execute the above method.

[0122] Computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).

[0123] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.

[0124] The units described in the embodiments of the present disclosure can be implemented in software or in hardware. In some cases, the name of the unit / module does not constitute a limitation on the unit itself.

[0125] The functions described above herein can be performed, at least in part, by one or more hardware logic components. By way of example, and not limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0126] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0127] It should be noted that the embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0128] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or its similar expression means any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0129] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0130] The steps of the methods or algorithms described in connection with the embodiments disclosed herein can be implemented directly in hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0131] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A positioning method, characterized in that, The method includes: For any element in a page in a display state, in response to detecting a selection operation triggered for the element, obtain feature information of the element, where the feature information describes the state in which the element is presented in the page; Send the feature information to a target model, where the target model is obtained by learning from a source code file corresponding to the page, the source code file includes the source code corresponding to the element, and the element is implemented using the source code corresponding to the element; Receive position information predicted by the target model for the feature information, where the position information indicates the position where the source code corresponding to the element is located in the source code file.

2. The method according to claim 1, wherein The process of determining the target model includes: Obtain the source code file, at least one piece of feature information, and the mapping relationship between each piece of feature information in the at least one piece of feature information and each code block in the source code file, where different pieces of feature information in the at least one piece of feature information describe different elements; Construct training data according to the mapping relationship, where the training data indicates the mapping relationship; Use the training data to train the target model.

3. The method according to claim 2, wherein The process of obtaining the at least one piece of feature information includes: Compile the source code file to obtain a compiled file, where the compiled file indicates the feature information of different elements in the page; Determine the at least one piece of feature information according to the compiled file.

4. The method according to claim 1, wherein The source code file includes code blocks of at least one component, and the element is implemented using the code blocks of one or more of the components; The process of determining the target model includes: Obtain the source code file and the description information of each of the at least one component, where the description information of each component respectively indicates the features of each component; Respectively determine the positions where the description information of each component is located in the source code file according to the positions where the code blocks of each component are located in the source code file; Add the description information of each component to the source code file according to the positions where the description information of each component is located in the source code file to obtain an added file; Construct training data according to the added file; Use the training data to train the target model.

5. The method according to claim 4, characterized in that, For any one of the at least one component, the description information of the component is obtained by analyzing the code block of the component.

6. The method according to claim 1, wherein After receiving the position information predicted by the target model for the feature information, the method further includes: In response to detecting that feedback information provided for the position information indicates that the position information is inaccurate, send the feedback information to the target model, and the target model is used to be updated according to the feedback information.

7. The method according to claim 1, characterized in that, The page belongs to a target object, and the target object is an application program or a web page; The target model is obtained by learning from all source code files in the project file of the target object.

8. The method according to any one of claims 1-7, characterized in that, The method is applied to a browser plugin; For any element in a page in a display state, in response to detecting a selection operation triggered for the element, obtaining the feature information of the element includes: When the browser plugin is in an active state, for any element in the page in the display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element.

9. The method according to claim 8, characterized in that After receiving the position information predicted by the target model for the feature information, the method further includes: Open a code editor through the browser plugin, display the source code file in the code editor, and highlight the code indicated by the position information in the source code file in the code editor.

10. A positioning device, characterized in that, Includes: An obtaining unit, configured to, for any element in the page in the display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element, where the feature information describes the state presented by the element in the page; A sending unit, configured to send the feature information to a target model, where the target model is obtained by learning the source code file corresponding to the page, the source code file includes the source code corresponding to the element, and the element is implemented using the source code corresponding to the element; A receiving unit, configured to receive the position information predicted by the target model for the feature information, where the position information indicates the position of the source code corresponding to the element in the source code file.

11. The device according to claim 10, wherein, The positioning device is a browser plugin; The obtaining unit is specifically configured to: when the positioning device is in an active state, for any element in the page in the display state, in response to detecting a selection operation triggered for the element, obtain the feature information of the element.

12. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is configured to store instructions or computer programs; The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the method according to any one of claims 1-9.

13. A computer-readable medium, characterized in that, Instructions or computer programs are stored in the computer-readable medium, and when the instructions or computer programs run on the device, the device executes the method according to any one of claims 1-9.

14. A computer program product, characterized in that, It includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for executing the method according to any one of claims 1-9.