Page processing methods, devices and equipment
By defining page data collection configuration information and constructing a lifecycle callback unit processing device in mobile applications, the problems of low page data collection efficiency and insufficient security are solved, achieving efficient and secure page content acquisition and improving user experience and coverage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU ALIBABA INT INTERNET IND CO LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies suffer from low efficiency and coverage in mobile application page data collection, as well as insufficient security of online user data. In particular, during offline testing, it is impossible to obtain page content after real user operations.
By determining the page data collection configuration information of the mobile application, a processing device written in a scripting language is constructed. The data of the first and second page elements is obtained by using the lifecycle callback unit of the native page, ensuring that only the content of the allowed page elements is collected to avoid the leakage of user privacy. The lifecycle management unit monitors the opening and closing of pages to reach all pages.
It improved the efficiency of page data collection, enhanced the security of online user data and page coverage, and ensured a good user experience and saved system resources.
Smart Images

Figure CN115905758B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mobile application page processing technology, specifically to page processing methods and apparatus, as well as electronic devices. Background Technology
[0002] With the increasing prevalence of mobile smart devices (such as smartphones and tablets), more and more mobile terminal applications, or simply mobile applications (APPs), have emerged. The page content of mobile applications is a crucial type of data, and many processing methods require access to it. For example, international e-commerce apps need to detect untranslated content on the page. Currently, a typical method for obtaining mobile application page content is to capture screenshots and then manually or using text recognition algorithms to extract the various textual information from the screenshots.
[0003] However, in the process of realizing this invention, the inventors found that the above solution has at least the following problems: 1) Whether the text is identified manually or by algorithm, the efficiency of page data collection is low; 2) Page screenshots include the complete content of the page, which may involve user privacy information, so they are only suitable for offline testing of mobile applications, and not for processing mobile applications that have already been launched; 3) The page displayed in the offline testing phase is not the page displayed after real user operation, so there are some pages that cannot be touched, and it is impossible to obtain screenshots of these pages, and therefore it is impossible to perform missing page detection and other processing on these pages. Summary of the Invention
[0004] This application provides a page processing method to address the problems of low page data collection efficiency, low page coverage, and low online user data security in existing technologies. This application also provides a page processing apparatus and an electronic device.
[0005] This application provides a page processing method, including:
[0006] Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language.
[0007] Construct a processing device written in a scripting language for collecting data from elements on the second page;
[0008] When processing the target native page, the data of the first page element included in the target native page is obtained through the lifecycle callback unit of the native page according to the configuration information;
[0009] When processing the Web view components included in the target native page, the lifecycle callback unit obtains the data of the second page elements included in the target native page through the processing device according to the configuration information;
[0010] Process the data of the first page element and the data of the second page element.
[0011] Optionally, the configuration information includes: an identifier of at least one native page; the step of collecting page data of the target native page according to the configuration information includes:
[0012] If the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
[0013] Optionally, the configuration information may also include: an identifier for at least one page element;
[0014] The page data collected from the target native page includes:
[0015] Based on the identifier of the at least one page element, obtain the data of at least one page element included in the target native page.
[0016] Optionally, the configuration information may further include: page element type information; the page element type includes: a first page element type and / or a second page element type;
[0017] The step of obtaining data of at least one page element included in the target native page based on the identifier of the at least one page element includes:
[0018] Based on the identifier of the at least one page element and the corresponding page element type, obtain the data of the first page element and the data of the second page element included in the target native page.
[0019] Optionally, the configuration information includes: switch information for performing page data acquisition and processing;
[0020] If the switch information is on, then the page data of the target native page is obtained.
[0021] Optionally, the configuration information includes: page data collection frequency;
[0022] Based on the page data collection frequency, obtain the page data of the target native page.
[0023] Optional, also includes:
[0024] When the target native page is opened, the configuration information is obtained through the lifecycle callback unit;
[0025] When leaving the target native page, the lifecycle callback unit obtains the data of the first page element according to the configuration information; the processing device obtains the data of the second page element according to the configuration information.
[0026] Optional, also includes:
[0027] When processing the Web view components included in the target native page, the lifecycle callback unit inserts the processing device into the Web view components.
[0028] Optional, also includes:
[0029] Based on the lifecycle callback unit and the processing device, a software development kit is generated, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system;
[0030] Deploy the software development kit to the target mobile application.
[0031] Optional, also includes:
[0032] Determine the path and location of page elements;
[0033] The processing of the data of the first page element and the data of the second page element includes:
[0034] Based on the path location, process the data of the first page element and the data of the second page element.
[0035] Optionally, processing the data of the first page element and the data of the second page element includes:
[0036] Based on the data of the first page element and the data of the second page element, obtain the untranslated data included in the target native page.
[0037] This application also provides a page processing method, including:
[0038] Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language.
[0039] Based on the configuration information, page data of the target native page is collected, including data of the first page element and data of the second page element;
[0040] Process the page data of the target native page.
[0041] This application also provides a page processing apparatus, including:
[0042] The configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language.
[0043] The processing device construction unit is used to construct a processing device written in a scripting language for collecting data of elements on the second page.
[0044] The first page element data acquisition unit is used to acquire the data of the first page elements included in the target native page according to the configuration information through the lifecycle callback unit of the native page when processing the target native page;
[0045] The second page element data acquisition unit is used by the lifecycle callback unit to acquire the data of the second page elements included in the target native page through the processing device according to the configuration information when processing the Web view components included in the target native page;
[0046] The page data processing unit is used to process the data of the first page element and the data of the second page element.
[0047] This application also provides an electronic device, including:
[0048] Processor and memory;
[0049] A memory for storing a program that implements any of the page processing methods described above, wherein the device is powered on and the program of the method is executed by the processor.
[0050] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the various methods described above.
[0051] This application also provides a computer program product including instructions that, when run on a computer, cause the computer to perform the various methods described above.
[0052] Compared with the prior art, this application has the following advantages:
[0053] The page processing method provided in this application determines the page data collection configuration information of a mobile application; constructs a processing device written in a scripting language for collecting data of second page elements; when processing a target native page, the lifecycle callback unit of the native page obtains the data of the first page elements included in the target native page according to the configuration information; when processing Web view components included in the target native page, the lifecycle callback unit obtains the data of the second page elements included in the target native page according to the configuration information through the processing device; and processes the data of the first page elements and the data of the second page elements. This processing method allows for the collection of page content from an online app based on configuration information. Since the configuration information includes page element collection restrictions, only allowed page element content is collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Meanwhile, since the page lifecycle management unit collects page element data based on configuration information, and the native page lifecycle callback unit is a necessary step for all native pages, the page lifecycle management unit can monitor the opening and closing of all pages, thus reaching all pages of the mobile application and avoiding the collection of only a portion of native pages specified by test users, thereby effectively improving page coverage. Furthermore, by reading page content through page elements, avoiding the need to identify page content from page screenshots, page data collection efficiency can be effectively improved.
[0054] The page processing method provided in this application determines the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. Based on the configuration information, page data of the target native page is collected and processed. This processing method allows for the collection of page content from an online app based on configuration information. Since the configuration information includes page element collection restrictions, only allowed page element content is collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Furthermore, because page element data is collected based on the configuration information through a page lifecycle management unit, and the page lifecycle management unit can monitor the opening and closing of all pages, all pages of the mobile application can be reached, avoiding the collection of only a portion of the native pages specified by the test user, thus effectively improving page coverage. Moreover, because page content is read through page elements, page content is not identified from page screenshots, thus effectively improving the efficiency of page data collection. Attached Figure Description
[0055] Figure 1 This application provides a flowchart illustrating the page processing method.
[0056] Figure 2 This application provides a schematic diagram illustrating the application scenarios of the page processing method.
[0057] Figure 3 This application provides a schematic diagram of the page processing apparatus. Detailed Implementation
[0058] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0059] This application provides page processing methods and apparatus, as well as electronic devices. The various solutions are described in detail in the following embodiments.
[0060] First Embodiment
[0061] Please refer to Figure 1 This is a flowchart illustrating an embodiment of the page processing method of this application. In this embodiment, the method may include the following steps:
[0062] Step S101: Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language.
[0063] The method provided in this application embodiment can collect and process page content for the native pages of online mobile applications. Mobile applications run on mobile internet devices (mobile terminals), which are terminal devices that access the internet via wireless network technology.
[0064] The native page of the mobile application includes first page elements written in the native language of the mobile operating system and a Web view component. The Web view component includes second page elements written in Hypertext Markup Language. The first page elements are developed in the native language of the mobile operating system, and the second page elements are developed in Hypertext Markup Language (such as HTML).
[0065] like Figure 2As shown, in this embodiment, the second page element is developed within the native page using an H5 framework, and its content is displayed on the native page using a Web view component (also known as a Web view container). The interface displayed to the user by the mobile application is the native page. Native pages on different mobile operating systems can use different programming languages; for example, native pages for Android systems are developed using Java, while native pages for iOS systems are developed using Objective-C. The native page displays page content generated based on H5 code through a Web view component.
[0066] Configuration information, including settings for processing page content collection from native pages of the mobile application, applies to all pages of the mobile application. This configuration information includes, but is not limited to: identifiers of at least one native page allowed to collect page data, identifiers of at least one page element within the native page allowed to collect element data, page element type information, on / off information for performing page data collection processing, and page data collection frequency. The page element type can be either a first page element (native page element of the mobile operating system) or a second page element (native page element of the H5 framework).
[0067] Mobile applications typically include multiple native pages. The configuration information may include identifiers of at least one native page that is allowed to collect page data (referred to as a page whitelist), or identifiers of at least one native page that is not allowed to collect page data (referred to as a page blacklist).
[0068] In one example, the configuration information includes the identifier of at least one native page that is allowed to collect page data; correspondingly, if the identifier of the at least one native page includes the identifier of a target native page, then the page data of the target native page is collected. This approach allows for the specification of one or more native pages in the mobile application that require page data collection, avoiding the collection of page content from other native pages; therefore, it effectively improves the security of page content collection.
[0069] A native page typically includes multiple page elements. The configuration information may include the identifier of at least one page element in the native page that is allowed to collect element data (referred to as the element whitelist), or the identifier of at least one page element that is not allowed to collect element data (referred to as the element blacklist).
[0070] In one example, the configuration information includes: an identifier for at least one page element in the native page whose data is allowed to be collected; accordingly, based on the identifier of the at least one page element, data of at least one page element included in the target native page is collected. This processing method allows for the specification of page elements in the native page whose content can be obtained, such as plain text elements, rich text elements, and input boxes, avoiding the collection of data from other page elements (such as password input boxes); therefore, it can effectively improve the security of page content collection.
[0071] Native web pages typically include two types of page elements: first page elements from the mobile operating system and second page elements from the H5 framework. In one example, the configuration information includes: page element type information; the page element type includes: first page element type and / or second page element type; correspondingly, the step of collecting data of at least one page element included in the target native page based on the identifier of the at least one page element can be implemented as follows: based on the identifier of the at least one page element and the corresponding page element type, collect data of the first page element and the second page element included in the target native page. This processing method distinguishes between the first page element and the second page element, and even if the first page element and the second page element have the same name, resulting in an element name conflict, the data of the first page element and the second page element can still be accurately collected; therefore, it can effectively improve the accuracy of page content collection.
[0072] In one example, the configuration information includes: switch information for performing page data collection processing; correspondingly, if the switch information is on, page data of the target native page is collected; if the switch information is off, page data of the target native page is not collected. The switch information refers to information on whether the page data collection processing function of the mobile application is enabled. If the switch information is on, data can be collected from any native page of the mobile application using the method provided in this application embodiment; if the switch information is off, data is not collected from the native pages of the mobile application. This processing method eliminates the need to release a new version of the mobile application during gray-scale disaster recovery processing, thus not affecting user experience; therefore, it can effectively improve the user experience.
[0073] In one example, the configuration information includes: page data collection frequency; accordingly, page data of the target native page is collected according to the page data collection frequency. The page data collection frequency includes, but is not limited to: for the same native page, the number of page openings between the last collected page data and the current collected page data reaches a threshold. The threshold can be determined according to application requirements. For example, setting the threshold to 1000 means that the content of the same page will only be collected once every 1000 times opened by the same user, or the content of the same page will only be collected once every 1000 times opened by multiple users. This approach avoids frequent collection of the same page's content, effectively saving system resources on the mobile terminal.
[0074] In one example, configuration information can be set via the client and uploaded to the server for storage. Different mobile devices can retrieve this configuration information from the server, eliminating the need for local storage on the mobile devices. For instance, a user opens the mobile application's data collection configuration page through their client (such as a PC, tablet, or laptop), specifies the target mobile application, and configures the aforementioned settings. The client then sends a configuration information setting request for the target mobile application to the server. The server extracts the user's configuration information from this request and saves it. This approach ensures that when the configuration information changes, only the server-stored configuration information needs to be maintained, without requiring updates to the configuration information on each mobile device; thus, it effectively improves the maintainability of the configuration information.
[0075] Step S103: Collect page data of the target native page according to the configuration information.
[0076] The page data includes data from the first page element and data from the second page element. Based on the configuration information, data from the first page element and data from the second page element of the target native page can be collected respectively.
[0077] In one example, step S103 may include the following sub-steps:
[0078] Step S1031: When the target native page is opened, obtain the configuration information.
[0079] In practice, the configuration information can be obtained from the local storage of the mobile device or requested from the server.
[0080] Step S1033: When leaving the target native page, obtain the page data of the target native page according to the configuration information.
[0081] In practice, after obtaining the configuration information, the configuration information for the target native page can be retrieved from the configuration information based on the identifier of the target native page, so as to obtain the page data of the target native page based on the configuration information for the target native page.
[0082] The method provided in this application determines the timing of page data collection to be when the page is closed, so that page content is read only when leaving the page. This does not block page opening or the main thread; therefore, it can effectively ensure page opening performance and thus ensure a good user experience.
[0083] In one example, the mobile operating system is Android, and the native language of the mobile operating system is JAVA. The method may further include the following steps: constructing a processing device written in JAVA scripting language (javascript) for collecting second page element data. The processing device is a virtual device, and the program code of the device includes, but is not limited to: code for obtaining the root element reference of the second page element tree of the target native page; and code for obtaining the second page element data of the target native page based on the root element reference and the configuration information of the target native page.
[0084] In specific implementation, the processing device can be deployed within the lifecycle callback unit of the native page. The program code of the lifecycle callback unit includes, but is not limited to: code for obtaining the configuration information; code for obtaining the configuration information of the target native page based on its identifier; and the program code of the processing device. Furthermore, the program code may also include: code for sending the collected page data to the server.
[0085] When the processing device is constructed, step S103 can be implemented as follows: the lifecycle callback unit of the native page obtains the data of the first page element included in the target native page according to the configuration information; when the lifecycle callback unit processes the Web view component included in the native page, it obtains the data of the second page element included in the target native page through the processing device.
[0086] The native page elements, including first page elements and Web view components, are traversed through a lifecycle callback unit. When traversing to the first page element, the lifecycle callback unit retrieves the data of the first page element according to the configuration information. When traversing to the Web view component, the processing device is inserted into the Web view component to retrieve the data of the second page elements included in the target native page. The processing device can obtain a root element reference of the second page element tree and traverse the second page elements based on the root element reference. When traversing to the second page element, the processing device retrieves the data of the second page element according to the configuration information. This processing method allows the processing device to traverse the second page elements in a sub-thread; therefore, it can effectively ensure page processing performance (such as page opening or closing performance), thereby ensuring a good user experience.
[0087] In practice, the identifier of the currently opened target native page can be obtained through the page open event response unit; the identifier of the currently closed target native page can be obtained through the page close event response unit.
[0088] The method provided in this application embodiment constructs the processing device and uses a lifecycle callback unit to read page content during page processing. Since the lifecycle callback unit is a necessary step for all native pages, this processing method can collect page content from all native pages of a mobile application, thereby effectively improving page coverage.
[0089] In one example, the method may further include the following steps: generating a software development kit (SDK) based on the lifecycle callback unit and the processing device, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system; and deploying the SSD to the target mobile application. Because the lifecycle callback unit uses aspect-oriented programming (AOP) technology, it can isolate different parts of the application logic, thereby reducing the coupling between different parts of the application logic and achieving program instrumentation; therefore, it can effectively improve development efficiency and scalability.
[0090] Step S105: Process the page data of the target native page.
[0091] In practice, various processing methods can be used to process the page data of the target native page, such as missing translation detection or other page content repair processing. Missing translation detection refers to identifying untranslated content in the target native page based on collected page data during mobile application localization. Mobile application localization refers to the process of translating the mobile application's user interface and auxiliary documentation from its country of origin into another language to adapt it to a foreign language and culture.
[0092] In one example, the method may further include the following steps: determining the path position of a page element; correspondingly, step S105 may be implemented as follows: processing the page data of the target native page based on the path position. The path position includes all ancestor elements on the path pointing to the target element, and the target element can be returned based on the path position. This processing method allows for accurate location of the page position of the collected page data; therefore, it can effectively improve the accuracy of page processing.
[0093] As can be seen from the above embodiments, the page processing method provided in this application determines the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. Based on the configuration information, page data of the target native page is collected and processed. This processing method allows for the collection of page content from an online app based on configuration information. Since the configuration information includes page element collection restrictions, only allowed page element content is collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Furthermore, because page element data is collected based on configuration information through a page lifecycle management unit, and the page lifecycle management unit can monitor the opening and closing of all pages, all pages of the mobile application can be reached, avoiding the collection of only a portion of the native pages specified by the test user, thus effectively improving page coverage. Moreover, because page content is read through page elements, page content is not identified from page screenshots, thus effectively improving page data collection efficiency.
[0094] Second Embodiment
[0095] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing apparatus. This apparatus corresponds to the embodiments of the above method. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0096] This application provides a page processing device comprising: a configuration information determination unit, a page data acquisition unit, and a page data processing unit.
[0097] A configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. A page data collection unit is used to collect page data of the target native page according to the configuration information. The page data includes data of the first page element and data of the second page element. A page data processing unit is used to process the page data of the target native page.
[0098] In one example, the configuration information includes: an identifier of at least one native page; the page data acquisition unit is specifically used to acquire the page data of the target native page if the identifier of the at least one native page includes the identifier of the target native page.
[0099] In one example, the configuration information further includes: an identifier of at least one page element; the collection of page data of the target native page includes: obtaining data of at least one page element included in the target native page based on the identifier of the at least one page element.
[0100] In one example, the configuration information further includes: page element type information; the page element type includes: a first page element type and / or a second page element type; the step of obtaining data of at least one page element included in the target native page based on the identifier of the at least one page element includes: obtaining data of the first page element and data of the second page element included in the target native page based on the identifier of the at least one page element and the corresponding page element type.
[0101] In one example, the configuration information includes: switch information for performing page data collection processing; if the switch information is on, then the page data of the target native page is acquired.
[0102] In one example, the configuration information includes: page data collection frequency; and obtaining page data of the target native page according to the page data collection frequency.
[0103] In one example, the page data acquisition unit is specifically used to obtain the configuration information when opening the target native page; and to obtain the page data of the target native page according to the configuration information when leaving the target native page.
[0104] In one example, the apparatus further includes: a processing device construction for constructing a processing device written in a scripting language for collecting data of second page elements; the page data collection unit is specifically used to obtain data of the first page elements included in the target native page according to the configuration information through the lifecycle callback unit of the native page; when the lifecycle callback unit processes the Web view components included in the native page, it obtains data of the second page elements included in the target native page according to the configuration information through the processing device.
[0105] In one example, the apparatus further includes a processing device insertion unit for inserting the processing device into the Web view component when the lifecycle callback unit processes the Web view component included in the target native page.
[0106] In one example, the apparatus further includes: a packaging unit and a deployment unit. The packaging unit is used to generate a software development kit (SDK) based on the lifecycle callback unit and the processing device, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system; the deployment unit is used to deploy the SSD to the target mobile application.
[0107] In one example, the apparatus further includes: a path location determination unit for determining the path location of a page element; and a page data processing unit specifically configured to process the data of the first page element and the data of the second page element based on the path location.
[0108] In one example, the page data processing unit is specifically used to obtain the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
[0109] Third Embodiment
[0110] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing method. This method corresponds to the embodiments of the above methods. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0111] Please refer to Figure 3 This is a flowchart illustrating an embodiment of the page processing method of this application. In this embodiment, the method may include the following steps:
[0112] Step S301: Determine the page data collection configuration information for the mobile application.
[0113] The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component, wherein the Web view component includes a second page element written in Hypertext Markup Language.
[0114] like Figure 2 As shown, in this embodiment, the second page element is developed within the native page using an H5 framework, and its content is displayed on the native page using a Web view component (also known as a Web view container). The interface displayed to the user by the mobile application is the native page. Native pages on different mobile operating systems can use different programming languages; for example, native pages for Android systems are developed using Java, while native pages for iOS systems are developed using Objective-C. The native page displays page content generated based on H5 code through a Web view component. Figure 2 The process involves collecting content from native English web pages and then performing translation error detection based on the collected content.
[0115] The configuration information includes processing information for collecting page content from the native pages of the mobile application, and can be applied to all pages of the mobile application. The configuration information in this embodiment is the same as the configuration information in Embodiment 1 above; relevant explanations can be found in Part 1 of the embodiment, and will not be repeated here.
[0116] Step S303: Construct a processing device written in a scripting language for collecting data of elements on the second page.
[0117] The scripting languages include, but are not limited to, JavaScript and VBScript. For example, a processing device written in JavaScript can be constructed to collect data from elements on a second page.
[0118] The processing device is a virtual device, and its program code includes, but is not limited to: code for obtaining a root element reference of the second page element tree of the target native page; and code for obtaining second page element data of the target native page based on the root element reference and the configuration information of the target native page. Furthermore, the program code may also include: code for obtaining the configuration information; code for obtaining the configuration information of the target native page based on its identifier; and code for sending the collected page data to the server.
[0119] In specific implementation, the processing device can be deployed within the lifecycle callback unit of the native page. The program code of the lifecycle callback unit includes, but is not limited to: code for obtaining the configuration information; code for obtaining the configuration information of the target native page based on its identifier; and the program code of the processing device. Furthermore, the program code may also include: code for sending the collected page data to the server.
[0120] In one example, the method may further include the following steps: generating a software development kit (SDK) based on the lifecycle callback unit and the processing device, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system; and deploying the SSD to the target mobile application. Because the lifecycle callback unit uses aspect-oriented programming (AOP) technology, it can isolate different parts of the application logic, thereby reducing the coupling between different parts of the application logic and achieving program instrumentation; therefore, it can effectively improve development efficiency and scalability.
[0121] Step S305: When processing the target native page, the data of the first page element included in the target native page is obtained through the lifecycle callback unit of the native page according to the configuration information.
[0122] Step S307: When processing the Web view components included in the target native page, the lifecycle callback unit obtains the data of the second page elements included in the target native page through the processing device according to the configuration information.
[0123] The native page's lifecycle callback unit is a virtual device built into the mobile operating system, and the processing device can be a piece of JavaScript code. The lifecycle callback unit traverses the elements of the native page, which include the first page elements and Web view components. When traversing to the first page element, the lifecycle callback unit retrieves the data of the first page element according to the configuration information; when traversing to the Web view component, it invokes the processing device. The processing device can obtain a reference to the root element of the second page element tree and traverses the second page elements based on the root element reference. When traversing to the second page element, the processing device retrieves the data of the second page element according to the configuration information.
[0124] In one example, the method may further include the following steps: when the lifecycle callback unit processes the Web view component included in the target native page, it inserts the processing device into the Web view component, and the Web view component can execute the JavaScript code included in the processing device, traverse the second page elements, and obtain the data of the second page elements according to the configuration information.
[0125] In one example, the method may further include the following steps: when opening the target native page, obtaining the configuration information through the lifecycle callback unit; correspondingly, when leaving the target native page, executing the above steps S303 and S305. Specifically, the identifier of the currently opened target native page can be obtained through the page open event response unit of the native page; the identifier of the currently closed target native page can be obtained through the page close event response unit. This processing method ensures that the timing for collecting page data is determined to be when the page is closed, and that page content is only read when leaving the page through the lifecycle callback unit and the processing device. This avoids blocking page opening and the main thread; therefore, it effectively ensures page opening performance, thereby ensuring a good user experience.
[0126] Step S309: Process the data of the first page element and the data of the second page element.
[0127] In practice, various processing methods can be used to handle the page data of the target native page, such as untranslated content detection or other page content repair. Untranslated content detection refers to identifying untranslated content in the target native page based on the collected page data during the localization process of the mobile application. Figure 2 As shown, mobile application localization refers to the process of translating the user interface and supporting documentation of a mobile application from its country of origin into another language to adapt it to a foreign language and culture.
[0128] As can be seen from the above embodiments, the page processing method provided in this application determines the page data collection configuration information of a mobile application; constructs a processing device written in a scripting language for collecting data of second page elements; when processing a target native page, the lifecycle callback unit of the native page obtains the data of the first page elements included in the target native page according to the configuration information; when the lifecycle callback unit processes the Web view components included in the target native page, the processing device obtains the data of the second page elements included in the target native page according to the configuration information; and processes the data of the first page elements and the data of the second page elements. This processing method enables the collection of page content from an online APP based on configuration information. Since the configuration information includes page element collection restriction information, only the content of page elements that are allowed to be collected will be collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Meanwhile, since the page lifecycle management unit collects page element data based on configuration information, and the native page lifecycle callback unit is a necessary step for all native pages, the page lifecycle management unit can monitor the opening and closing of all pages, thus reaching all pages of the mobile application and avoiding the collection of only a portion of native pages specified by test users, thereby effectively improving page coverage. Furthermore, by reading page content through page elements, avoiding the need to identify page content from page screenshots, page data collection efficiency can be effectively improved.
[0129] Fourth embodiment
[0130] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing apparatus. This apparatus corresponds to the embodiments of the above method. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0131] This application provides a page processing apparatus comprising: a configuration information determination unit, a second binder construction unit, a first page element data acquisition unit, a second page element data acquisition unit, and a page data processing unit.
[0132] A configuration information determination unit is used to determine the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. A processing device construction unit is used to construct a processing device written in a scripting language for collecting data of the second page element. A first page element data acquisition unit is used to acquire the data of the first page element included in the target native page according to the configuration information through the lifecycle callback unit of the native page when processing the target native page. A second page element data acquisition unit is used to acquire the data of the second page element included in the target native page according to the configuration information through the processing device when the lifecycle callback unit processes the Web view component included in the target native page. A page data processing unit is used to process the data of the first page element and the data of the second page element.
[0133] In one example, the configuration information includes: an identifier of at least one native page; if the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
[0134] In one example, the configuration information further includes: an identifier of at least one page element; and, based on the identifier of the at least one page element, obtaining data of the at least one page element included in the target native page.
[0135] In one example, the configuration information further includes: page element type information; the page element type includes: a first page element type and / or a second page element type; based on the identifier of the at least one page element and the corresponding page element type, the data of the first page element and the data of the second page element included in the target native page are obtained.
[0136] In one example, the configuration information includes: switch information for performing page data collection processing; if the switch information is on, then the page data of the target native page is acquired.
[0137] In one example, the configuration information includes: page data collection frequency; and obtaining page data of the target native page according to the page data collection frequency.
[0138] In one example, the device further includes: a configuration information acquisition unit, configured to acquire the configuration information through the lifecycle callback unit when the target native page is opened; and to activate the first page element data acquisition unit and the second page element data acquisition unit when the target native page is left.
[0139] In one example, the apparatus further includes a processing device insertion unit for inserting the processing device into the Web view component when the lifecycle callback unit processes the Web view component included in the target native page.
[0140] In one example, the apparatus further includes: a packaging unit and a deployment unit. The packaging unit is used to generate a software development kit (SDK) based on the lifecycle callback unit and the processing device, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system; the deployment unit is used to deploy the SSD to the target mobile application.
[0141] In one example, the apparatus further includes: a path location determination unit for determining the path location of a page element; and a page data processing unit specifically configured to process the data of the first page element and the data of the second page element based on the path location.
[0142] In one example, the page data processing unit is specifically used to obtain the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
[0143] Fifth Embodiment
[0144] This application also provides an electronic device. Since the device embodiments are substantially similar to the method embodiments, the description is relatively simple; relevant details can be found in the description of the method embodiments. The device embodiments described below are merely illustrative.
[0145] This embodiment provides an electronic device, which includes a processor and a memory; the memory is used to store a program that implements a page processing method, and the device is powered on and runs the program of the method through the processor.
[0146] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0148] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0149] 1. Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.
[0150] 2. Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A page processing method, characterized in that, include: The configuration information for collecting page data in a mobile application is determined. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. The configuration information includes page element collection restriction information. Construct a processing device written in a scripting language for collecting data from elements on the second page; When processing the target native page, the data of the first page element included in the target native page is obtained according to the configuration information through the lifecycle callback unit of the native page; the lifecycle callback unit is used to monitor the opening and closing of all pages; When processing the Web view components included in the target native page, the lifecycle callback unit obtains the data of the second page elements included in the target native page through the processing device according to the configuration information; Processing the data of the first page element and the data of the second page element includes: obtaining untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
2. The method according to claim 1, characterized in that, The configuration information includes: an identifier for at least one native page; the step of collecting page data of the target native page according to the configuration information includes: If the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
3. The method according to claim 2, characterized in that, The configuration information also includes: the identifier of at least one page element; The page data collected from the target native page includes: Based on the identifier of the at least one page element, obtain the data of at least one page element included in the target native page.
4. The method according to claim 3, characterized in that, The configuration information also includes: page element type information; the page element type includes: a first page element type and / or a second page element type; The step of obtaining data of at least one page element included in the target native page based on the identifier of the at least one page element includes: Based on the identifier of the at least one page element and the corresponding page element type, obtain the data of the first page element and the data of the second page element included in the target native page.
5. The method according to any one of claims 1 to 4, characterized in that, The configuration information includes: switch information for performing page data collection and processing; If the switch information is on, then the page data of the target native page is obtained.
6. The method according to claim 1, characterized in that, The configuration information includes: page data collection frequency; Based on the page data collection frequency, obtain the page data of the target native page.
7. The method according to claim 1, characterized in that, Also includes: When the target native page is opened, the configuration information is obtained through the lifecycle callback unit; When leaving the target native page, the lifecycle callback unit obtains the data of the first page element according to the configuration information; the processing device obtains the data of the second page element according to the configuration information.
8. The method according to claim 1, characterized in that, Also includes: When processing the Web view components included in the target native page, the lifecycle callback unit inserts the processing device into the Web view components.
9. The method according to claim 1, characterized in that, Also includes: Based on the lifecycle callback unit and the processing device, a software development kit is generated, wherein the first page element data acquisition program code included in the lifecycle callback unit is written in the native language of the mobile operating system; Deploy the software development kit to the target mobile application.
10. The method according to claim 1, characterized in that, Also includes: Determine the path and location of page elements; The processing of the data of the first page element and the data of the second page element includes: Based on the path location, process the data of the first page element and the data of the second page element.
11. A page processing method, characterized in that, include: The configuration information for collecting page data in a mobile application is determined. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. The configuration information includes page element collection restriction information. Construct a processing device written in a scripting language for collecting data from elements on the second page; Based on the configuration information, page data of the target native page is collected. The page data includes data of the first page element and data of the second page element. This includes: when the target native page is opened, obtaining the configuration information through the lifecycle callback unit of the native page; when leaving the target native page, obtaining the data of the first page element based on the configuration information through the lifecycle callback unit; and obtaining the data of the second page element based on the configuration information through a processing device. The lifecycle callback unit is used to monitor the opening and closing of all pages. Processing the page data of the target native page includes: obtaining the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
12. A page processing apparatus, characterized in that, include: A configuration information determination unit is used to determine the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element written in the native language of the mobile operating system and a Web view component. The Web view component includes a second page element written in Hypertext Markup Language. The configuration information includes page element collection restriction information. The processing device construction unit is used to construct a processing device written in a scripting language for collecting data of elements on the second page. The first page element data acquisition unit is used to acquire the data of the first page elements included in the target native page according to the configuration information through the lifecycle callback unit of the native page when processing the target native page; the lifecycle callback unit is used to monitor the opening and closing of all pages; The second page element data acquisition unit is used by the lifecycle callback unit to acquire the data of the second page elements included in the target native page through the processing device according to the configuration information when processing the Web view components included in the target native page; The page data processing unit is used to process the data of the first page element and the data of the second page element, specifically to obtain the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
13. An electronic device, characterized in that, include: Processor and memory; A memory for storing a program implementing the page processing method according to any one of claims 1-11, wherein the device is powered on and the program of the method is executed by the processor.