Test method for application embedded webpage, electronic device and storage medium

By directly loading the page in the embedded webpage window and establishing a debugging connection, and issuing test commands adapted to the browser kernel protocol, the problem of large test code size and severe coupling in the existing technology is solved, and efficient and stable testing of application embedded webpages is achieved.

CN123157607APending Publication Date: 2026-11-24GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611593040.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-14
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In existing technologies, testing embedded web pages requires pre-embedded data collection logic or test code, which increases code size and processing overhead. Furthermore, it is heavily coupled with the client and server, resulting in poor test versatility, inadequate stability, and insufficient accuracy.

Method used

By directly loading the page under test in an embedded webpage window, establishing a debugging connection, and issuing test commands adapted to the browser kernel protocol, the test page and the target application are decoupled, reducing code size and processing overhead, and improving test stability and accuracy.

Benefits of technology

This decouples the tested page from the target application, reduces code size and processing overhead, improves the stability and accuracy of testing, and reduces the probability of random test case failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157607A_ABST
    Figure CN123157607A_ABST
Patent Text Reader

Abstract

This application discloses a testing method, electronic device, and storage medium for embedded web pages in applications. The method includes establishing a debugging connection with a page loaded in an embedded web page window of a target application; issuing test commands to the target application, the test commands controlling the embedded web page window to execute corresponding test operations, and the test commands being adapted to the browser kernel protocol of the target application; and outputting test results based on the execution results of the test operations performed on the page under test. By initializing the embedded web page window, loading the corresponding page under test, and establishing a debugging connection, the page under test can be directly attached to the embedded web page window, eliminating the need for pre-embedded data collection logic or code on the page under test. This reduces processing overhead and decouples the page under test from the client and server of the target application. Simultaneously, by issuing test commands corresponding to the test cases and adapted to the browser kernel protocol of the target application, the probability of random test case failures is reduced, improving stability and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, specifically to a testing method, electronic device, and storage medium for embedded web pages in applications. Background Technology

[0002] To alleviate client-server pressure, an increasing number of applications are implementing some functional pages as Hypertext Markup Language (HTML) web pages, running within the application's embedded browser view. In existing technologies, testing embedded web pages typically requires pre-embedded data collection logic or test code on the page under test, leading to increased code size and overhead during page loading and runtime. Furthermore, the strong coupling between the page under test and the target application's client and server limits the test's versatility, making it impossible to test pages without data collection mechanisms, and resulting in poor test case stability and a high failure rate. Summary of the Invention

[0003] This application provides a testing method, electronic device, and storage medium for embedded web pages. The page under test can be directly attached to the embedded web page window without pre-embedding collection logic or test code. The corresponding page under test is directly loaded and a debugging connection is established, reducing the code size of the page under test, page loading, and runtime processing overhead. This decouples the page under test from the client and server of the target application. At the same time, test commands adapted to the browser kernel protocol of the target application are issued to implement testing, which can reduce the probability of random failure of test cases and improve stability and accuracy.

[0004] On one hand, embodiments of this application provide a testing method for embedded web pages in an application. The method includes establishing a debugging connection with a page loaded in an embedded web page window of a target application; sending a test command to the target application, the test command being used to control the embedded web page window to perform a corresponding test operation, the test command being adapted to the browser kernel protocol of the target application; and outputting a test result based on the execution result of the test operation performed on the page under test.

[0005] On the other hand, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the application-embedded webpage testing method as described in any of the above embodiments by calling the computer program stored in the memory.

[0006] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the application-embedded webpage testing method as described in any of the above embodiments.

[0007] The application-embedded webpage testing method, electronic device, and storage medium provided in this embodiment initialize the embedded webpage window, load the corresponding page, and establish a debugging connection. This allows the page under test to be directly attached to the embedded webpage window, eliminating the need for pre-embedded data collection logic or test code. This directly loads the page under test, reducing its code size, page loading, and runtime processing overhead, and decoupling the page under test from the target application client and server. Furthermore, by issuing test commands corresponding to the browser kernel protocol adapted to the target application, the probability of random test case failures is reduced, improving stability and accuracy. Attached Figure Description

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

[0009] Figure 1 A schematic diagram of a test system for an application with an embedded webpage provided in an embodiment of this application; Figure 2 A first flowchart illustrating the testing method for embedded web pages provided in this application embodiment; Figure 3 A schematic diagram of the second process of the testing method for embedded web pages provided in the embodiments of this application; Figure 4 A schematic diagram of the third process of the testing method for embedded web pages provided in the embodiments of this application; Figure 5 A schematic diagram of the structure of the testing device for application-embedded web pages provided in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

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

[0011] This application provides a testing method, apparatus, storage medium, device, and program product for embedded web pages in applications. Specifically, the testing method for embedded web pages in applications can be executed by an electronic device, which can be a terminal or a server, etc.

[0012] The terminal can be a smartphone, tablet, laptop, smart TV, or other device. The terminal may also include a client, which may be a game client, browser client, instant messaging client, or mini-program, etc.

[0013] A server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0014] For example, when the test method for an application's embedded webpage runs on a terminal device, the terminal device may include a display screen and a processor. The display screen is used to present the interface and receive instructions generated by developers interacting with the interface. The processor is used to store the application, run the application, generate the interface, respond to instructions, and control the display of the interface on the display screen. When developers interact with the interface through the display screen, the interface can control the local content of the terminal device in response to received operation instructions. The terminal device can provide the graphical user interface to developers in various ways, such as rendering it on the terminal device's display screen or presenting the graphical user interface through holographic projection.

[0015] For example, when the test method for an embedded webpage runs on a server, this method can be implemented and executed based on a cloud system. A cloud system refers to a program execution method based on cloud computing. A cloud system includes servers and client devices. The application's execution body and interface presentation body are separate. The storage and execution of the test method for the embedded webpage are completed on the server. Interface presentation is completed on the client, which is mainly used for data reception, transmission, and interface presentation. For example, the client can be a display device with data transmission capabilities located close to the developer, such as a mobile terminal, television, computer, PDA, personal digital assistant, or head-mounted display device. However, the terminal device for data processing is the server in the cloud. When executing the test method for the embedded webpage, the developer operates the client to send instructions to the server. The server processes the data according to the instructions, encodes and compresses the interface data, returns it to the client via the network, and finally, the client decodes and outputs the interface.

[0016] It should be noted that in the embodiments of this application, the execution subject of the test method for embedded web pages can be a terminal device or a server. The embodiments of this application do not limit the type of execution subject.

[0017] It is understood that in the specific implementation of this application, user object data, context data and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0018] For example, in conjunction with the above description, Figure 1 This application illustrates a test system 1000 for implementing a test method for embedded web pages, provided by an embodiment of this application. The test system 1000 may include at least one terminal 1001, at least one server 1002, at least one database 1003, and a network. The terminal 1001 can connect to different servers via the network. The terminal can be any device with computing hardware capable of supporting and executing the corresponding software application tools.

[0019] In the aforementioned application-embedded webpage testing system 1000, terminal 1001 is used to install and run the application. In some cases, the application may not need to be pre-installed on terminal 1001, and developers can directly access the application interface through a browser or other client. Developers log in to the application using their registered accounts. When a developer logs in, terminal 1001 sends a login request to server 1002. Server 1002 verifies the account used by the developer, and if the verification is successful, server 1002 returns a login success notification to terminal 1001. During the execution of the application-embedded webpage testing method, terminal 1001 and server 1002 interact with each other. Terminal 1001 sends various information to server 1002. Server 1002 determines the display data for terminal 1001 based on the stored program mechanism and the received information, and sends the display data back to terminal 1001, so that terminal 1001 can display the display data sent by server 1002 to the developer.

[0020] In possible application scenarios, different terminals 1001 may be served by different servers 1002. Therefore, in order to distinguish the servers 1002 corresponding to different terminals 1001, the scenarios involving different terminals corresponding to different servers in this application embodiment will be described in the first and second ways.

[0021] Furthermore, when the application-embedded webpage testing system 1000 includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and servers. The network can be a wireless network or a wired network, such as a Wireless Local Area Network (WLAN), Local Area Network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Additionally, different terminals can also connect to other terminals or to servers using their own Bluetooth networks or hotspot networks. Furthermore, the system 1000 can include multiple databases, which are coupled to different servers.

[0022] It should be noted that, Figure 1 The schematic diagram of the application-embedded webpage testing system shown is merely an example. The application-embedded webpage testing system 1000 described in this application embodiment is to more clearly illustrate the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of application-embedded webpage testing systems and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0023] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0024] Please see Figure 2 It should be noted that the steps shown may be executed in a logical order different from that shown in the flowchart of this method. The application-embedded webpage testing method of this application may include the following steps: Step 011: Establish a debugging connection with the page loaded by the target application in the embedded webpage window; Step 012: Send test commands to the target application. The test commands are used to control the embedded web page window to perform corresponding test operations. The test commands are adapted to the browser kernel protocol of the target application. Step 013: Based on the execution results of the test operation performed on the page under test, output the test results.

[0025] In this context, embedded web pages refer to Hypertext Markup Language (HTML) web pages rendered and displayed within the host application's process using an embedded browser engine. Examples include gameplay pages, debugging tool pages, and data panel pages in game clients, which are implemented using web page technologies and run within embedded web page windows.

[0026] An embedded webpage window refers to a view component within a target application used to display webpage content, rendered and interacted with by the browser engine. For example, a webpage view embedded in a game client to display activity pages.

[0027] Testing methods refer to the methods used to automatically verify the interface structure, functional logic, and interactive behavior of web pages embedded in an application. For example, automatically verifying whether a reward confirmation dialog box pops up after clicking the "Claim" button.

[0028] The target application refers to the host application that embeds a web page window. Examples include game clients and desktop applications built on top of desktop application runtimes.

[0029] The test side refers to an independent automated test execution side, which includes debugging clients and test cases.

[0030] A debug connection refers to a communication connection established between the test side and the page under test in an embedded web window, used to transmit test commands and execution results. For example, a persistent bidirectional communication connection established based on a full-duplex communication protocol.

[0031] Pre-defined test cases refer to pre-written automated test scripts used to verify specific functions or behaviors of the page under test. For example, a test script to verify whether a success message is displayed after a user fills out a form and clicks the submit button.

[0032] Test commands are instructions sent from the testing side to the browser kernel via a debugging connection to control the page under test to perform specific operations. Examples include commands to click a button, commands to read the document object model structure, and commands to execute scripts.

[0033] A browser kernel refers to the engine component responsible for parsing and rendering web pages and executing scripts. Examples include a full browser kernel that runs as a separate process and a lightweight browser kernel that is embedded in the application process's memory.

[0034] In some embodiments, the test command further includes at least one of document object model manipulation commands, script evaluation commands, interactive simulation commands, and screenshot commands.

[0035] Document Object Model (DOM) manipulation commands refer to test commands used to query or modify the document object model structure of the page under test. Examples include commands such as retrieving the document root node, querying elements by selector, and retrieving element attributes.

[0036] Script evaluation commands are test commands used to execute script code within the script context of the page being tested and obtain the return value. For example, executing a script to calculate the text content of an element and return it.

[0037] Interactive simulation commands are test commands used to simulate user interactions on the page being tested. Examples include commands such as clicking an element, filling in an input box, and selecting a dropdown option.

[0038] The screenshot command is a test command used to capture an image of the page being tested or a specified element. For example, it can capture the entire visible area of ​​a page or just a specific button.

[0039] In this way, by using multiple types of test commands to cover the complete requirements of querying, operating, executing, and obtaining evidence in automated testing, the test side can accurately read and assert the structure and control properties of the document object model, simulate real user interaction, and take screenshots as evidence when failure occurs, thus providing more granular testing capabilities.

[0040] In some embodiments, the testing method for application-embedded web pages further includes: the test command and execution result are both JSON remote call messages.

[0041] JSON remote procedure call messages refer to remote procedure call messages that use JSON data format, and are divided into request messages and response messages. Request messages contain a request identifier, method name, and parameters, while response messages contain the same request identifier plus result or error information. For example, a request message might be {"id":1,"method":"Runtime.evaluate","params":{...}}, and a response message might be {"id":1,"result":{...}}.

[0042] Thus, using the JSON remote call message format results in a simple structure, easy parsing, and native compatibility with the browser kernel's remote debugging protocol.

[0043] In some embodiments, the testing side performs automated assertion judgments on the execution results and outputs the test results. A testing framework is used to manage and parameterize batch test cases in a structured manner. Configurable parameters include debug port, application proxy port, screenshot switch, and test execution phase. After test execution is complete, the test case execution results are automatically summarized, a standardized test report is generated, and screenshots of failed test cases are automatically saved, completing a single automated testing process.

[0044] Specifically, the game process is started, and the embedded webpage window is initialized. After the page (which can be the page under test or the initial page) is loaded by the target application, a debug connection is established with the page via the local loopback address. Test commands corresponding to the preset test cases are sent to the browser kernel via this debug connection. These test commands control the embedded webpage window to execute corresponding test operations, and are adapted to the browser kernel protocol. Upon receiving the test commands, the browser kernel executes the corresponding test operations within the context of the page under test. The browser kernel returns the execution results to the test side via the debug connection, thus outputting the test results. The test commands are JSON remote call request messages, and the execution results are JSON remote call response messages, both carried on the debug connection.

[0045] In one example, this implementation can be applied to an automated testing scenario for a Hypertext Markup Language (HMR) activity / gameplay page in a game engine. The game client is launched, the embedded webpage window is initialized, the page under test is loaded, and a full-duplex communication debugging connection is established. The test case needs to verify that "clicking the 'Claim' button will pop up a reward confirmation dialog box." The debugging client layer on the test side generates the test command corresponding to the test case and sends a JSON remote call request message to the browser kernel through the debugging connection. The test command executes the button click operation within the script context of the page under test. After execution, the browser kernel returns the execution result (JSON remote call response message) to the test side, indicating a pass.

[0046] This embodiment initializes an embedded webpage window, loads the corresponding page, and establishes a debugging connection, allowing the page under test to be directly attached to the embedded webpage window. This eliminates the need for pre-embedded data collection logic or test code on the page under test, reducing code size, page loading, and runtime processing overhead, and decoupling the page under test from the target application client and server. Simultaneously, by issuing test commands corresponding to the test cases and adapted to the target application's browser kernel protocol, the probability of random test case failures is reduced, improving stability and accuracy. The JSON remote call message format is used, which is simple in structure, easy to parse, and natively compatible with the browser kernel's remote debugging protocol.

[0047] Please see Figure 3 In some embodiments, the testing method for applying embedded web pages further includes: Step 014: After the initial page is loaded in the embedded webpage window, the target page address of the test page that matches the preset title or address in each debuggable page of the target application is obtained through the preset enumeration interface of the debug port. The test commands include navigation commands. Step 012 involves sending the test commands to the target application, including: Step 0121: Send a navigation command to the target application to control the embedded webpage window to load the page under test corresponding to the target page address.

[0048] The initial page refers to the page that loads by default when the embedded webpage window starts. This page may not be the final page that needs to be tested. For example, a blank page or a debug entry page that the embedded webpage window loads by default when the game starts.

[0049] The debug port refers to the communication port number that the browser kernel listens on on the local loopback address after enabling remote debugging protocols. For example, the default port is 9223.

[0050] An enumeration interface refers to the standard Hypertext Transfer Protocol interface provided by the browser kernel on the debugging port, used to obtain a list of all currently debuggable targets. For example, the target list can be obtained by accessing http: / / 127.0.0.1:9223 / json.

[0051] Debuggable pages refer to the pages that appear in the list returned by the target enumeration interface and can be attached to the debuggable connection. Each debuggable page corresponds to one target record.

[0052] Navigation commands are test commands used to control whether an embedded web page window loads a specified page address in the current view. For example, a command to make the current embedded web page window load the http: / / example.com / activity page.

[0053] Specifically, after the initial page is loaded in the embedded webpage window, the testing side obtains a list of all currently debuggable pages of the target application through a pre-defined target enumeration interface on the debugging port. Each target record in the list includes fields such as page title, page address, target type, and debugging connection address. The testing side uses a pre-defined title or address as a filter to match the page under test from the list and obtains the debugging connection address of that page to establish a debugging connection. When the initial page loaded by the embedded webpage window is not the page under test, a navigation command is sent to the browser kernel through the debugging connection to control the embedded webpage window to load the page under test corresponding to the target page address. The debugging connection address is used to establish the debugging connection, while the target page address is used for navigation loading; their functions are different.

[0054] In some embodiments, when the test side detects a page under test through a preset target enumeration interface filter, it calls the connection interface `connect_over_cdp(endpoint, title_filter)` via a self-developed lightweight CDP (Chrome DevTools Protocol) client layer. Simultaneously, based on the obtained debug connection address of the page under test, it establishes a full-duplex communication protocol connection with the target page. Based on this connection channel, it completes protocol adaptation and context binding, generating a standardized page object (CDPPage) in the Playwright calling paradigm to enable subsequent testing operations on the embedded webpage window.

[0055] Full-duplex communication protocols refer to communication protocols in which both parties can simultaneously send and receive data from the other end. After the communication link is established, both ends can actively initiate message exchanges without one party waiting for the other to request them, such as the WebSocket protocol.

[0056] Protocol adaptation refers to the conversion and compatibility processing of input commands and return messages to address the differences in protocol interfaces, fields, and behaviors between different versions of browser kernels. It shields the heterogeneity of the underlying protocol version, allowing upper-layer business to use a unified calling method without being aware of the differences in the underlying protocol version.

[0057] Context binding refers to associating and binding the debugging link, the instance identifier of the page under test, and the session state information, so that the debugging commands issued subsequently can be accurately routed to the page execution context of the corresponding embedded web page window, ensuring that the commands, returned data and the target page under test correspond one-to-one, and avoiding command confusion in multi-page scenarios.

[0058] Playwright is a web page automation testing framework for browser engines, which uses CDP to interact with browser instances.

[0059] Playwright's calling paradigm refers to the unified calling interface format, object methods, and parameter conventions exposed by the Playwright automated testing framework. This includes the calling format of interfaces such as page navigation, document object model lookup, script evaluation, and interactive simulation. Upper-level testing business logic can use this calling method to write test logic without needing to adapt to new interfaces.

[0060] Standardized page objects refer to abstract objects generated during encapsulation on the testing side. These objects shield the implementation details of the underlying browser kernel and communication links, providing a set of test methods that conform to the Playwright calling paradigm. These methods are used to perform test operations such as page navigation, querying, script evaluation, interaction simulation, and screenshotting, and are then called by upper-level test cases.

[0061] CDPPage refers to a standardized page object encapsulated based on the CDP protocol, shielding the underlying communication and protocol details and providing a test interface conforming to the Playwright calling paradigm. It is used to perform test operations on embedded web page windows, such as document object model lookup, script evaluation, interactive simulation, screenshotting, and page navigation.

[0062] In some embodiments, after establishing a connection channel and completing protocol adaptation and context binding, the test side encapsulates and generates a page object. This page object provides an operation interface, which the test side can call to issue various test operations to the embedded webpage window. A locator, created by the page object based on the passed-in selector, encapsulates the query rules for the target interactive element. It can correspond to a single or a group of page elements. The query rules carried by the locator are called by the page object to complete test operations such as element query, click, value filling, dropdown selection, attribute reading, bounding box acquisition, element screenshot, and reachability detection. Test cases issue test operations using the locator, read the data required for assertions through document object model operation commands, and the test side executes assertion judgments. If the assertion fails, the page screenshot interface is called to capture abnormal page images, and finally, the corresponding test report is output.

[0063] In one example, this embodiment can be applied to an automated testing scenario for a Hypertext Markup Language (HMR) activity gameplay page in a game engine. After the game client starts, the embedded webpage window loads the initial page by default. The test side sends a Hypertext Transfer Protocol (HTTP) request to "http: / / 127.0.0.1:9223 / json" to obtain a target list. One target record has the title "Activity Center," the address "http: / / game.example.com / activity," and the debug connection address "ws: / / 127.0.0.1:9223 / devtools / page / ABC123." The test side filters for this target using the preset title "Activity Center," extracts the debug connection address "ws: / / 127.0.0.1:9223 / devtools / page / ABC123," and establishes a full-duplex communication connection. If the current page is the initial page and not the page under test, the test side sends navigation commands through the debug connection to control the embedded webpage window to load "http: / / game.example.com / activity." After the page loads, subsequent test commands are executed.

[0064] This embodiment automatically discovers the page under test through a preset target enumeration interface, adapting to scenarios with dynamic port allocation and parallel testing of multiple instances. Simultaneously, using preset title or address filtering can prevent incorrect connections to other pages.

[0065] Please continue reading. Figure 3In some embodiments, the testing method for the application's embedded webpage further includes the following before establishing a debug connection: Step 015: In development mode, the debug port number is written to the preset environment variable through the interface provided by the application engine. When the browser kernel starts, it reads the preset environment variable to enable the debug port.

[0066] In this context, "development mode" refers to a runtime mode of the target application, where debugging-related functions are enabled but disabled in non-development mode. For example, a game client might be launched in development mode during internal testing but in non-development mode during official release.

[0067] An application engine refers to the core engine of a target application, responsible for initializing the application process, creating embedded web page windows, and launching the browser kernel. For example, a game engine.

[0068] The debugging port number refers to the port number used by the browser kernel when remote debugging protocols are enabled. For example, 9223.

[0069] Preset environment variables are variables in the operating system used to pass configuration information between processes, and are naturally inherited by child processes when they start. For example, an environment variable named NEOX_WEB_DEBUG_PORT has a value of the debug port number.

[0070] Specifically, when the game initializes the embedded webpage window in development mode, it writes the debugging port into a preset environment variable through an interface provided by the target application's engine. When the embedded browser kernel process starts, it reads the preset environment variable and converts it into remote debugging port startup parameters, thereby starting the remote debugging protocol on the corresponding port. In non-development mode, the engine does not write this environment variable, and the browser kernel does not read this variable when it starts, so the remote debugging protocol is not enabled.

[0071] In one example, this implementation can be applied to automated testing scenarios for Hypertext Markup Language (HML) gameplay pages in a game engine. When the game client initializes the embedded webpage window in development mode, the game engine calls the interface `enable_web_debug(9223)`, which sets the environment variable `NEOX_WEB_DEBUG_PORT` to 9223. Subsequently, the game engine launches the embedded full browser kernel process. When the browser kernel starts, it reads the environment variable `NEOX_WEB_DEBUG_PORT`, obtains the port number 9223, and enables the remote debugging protocol with the parameter `--remote-debugging-port=9223`. In non-development mode, the engine does not set this environment variable, the browser kernel does not start with the remote debugging port parameter, and the debugging port is not open.

[0072] This embodiment enables the debugging port only in development mode and disables it by default in production environment. This prevents remote debugging capabilities from being exploited in the production environment, which could lead to page data leakage or malicious control. It enables the port to be enabled on demand, ensuring security and controllability.

[0073] Please continue reading. Figure 3 In some embodiments, the testing method for applying embedded web pages further includes: Step 016: When the browser kernel starts, it reads the debug port number to enable the debug port. The debug port number is passed to the browser kernel via command-line parameters or runtime configuration files.

[0074] Command-line arguments refer to the parameters passed to the command line when starting the browser kernel process. For example, `--remote-debugging-port=9223`.

[0075] Runtime configuration files are those read by the browser engine or target application at startup, containing configuration items such as the debug port number. For example, the debug_config.ini file in the engine directory might contain port=9223.

[0076] Specifically, in addition to passing the debug port number via environment variables, it can also be passed to the browser kernel via command-line arguments or runtime configuration files. The browser kernel then starts the debug port by reading the debug port number from the command-line arguments or runtime configuration files.

[0077] In one example, this implementation can be applied to an automated testing scenario for Hypertext Markup Language (HMR) activity gameplay pages in a game engine. When the test side starts the game client via command line, it directly passes the parameter `--remote-debugging-port=9223`. The browser kernel, as a child process, inherits this command-line parameter and enables the debugging port.

[0078] In another example, this embodiment can be applied to automated testing scenarios for Hypertext Markup Language (HML) activity gameplay pages in game engines. Before startup, the game engine writes the debug port number to the runtime configuration file debug_config.ini. When the browser kernel starts, it reads this configuration file to obtain port number 9223 and enables the debug port.

[0079] This embodiment provides multiple methods for transmitting debug port numbers to adapt to different startup scenarios and deployment environments, enhancing the applicability and flexibility of the solution.

[0080] Please continue reading. Figure 3 In some embodiments, the test commands include interactive simulation commands, and the testing method for application-embedded web pages further includes: Step 017: Obtain the reachability detection result of the interactive simulation command. The reachability detection result includes whether the interactive simulation command meets the corresponding executable conditions. The executable conditions include at least one of the following conditions: the interactive element exists in the document object model, the interactive element is not hidden, the width and height of the interactive element are greater than zero, the interactive element is within the viewport range, and the interactive element is not occluded. Step 012: Send test commands to the target application, including: Step 0122: If the interactive simulation command meets the corresponding executable conditions, issue the interactive simulation command. The reachability detection result is obtained by the testing side before issuing the interactive simulation command, or by the target application after receiving the interactive simulation command. Step 0123: If the interactive simulation command does not meet the executable conditions, the reachability detection results are obtained in a loop within the preset waiting time until the interactive simulation command meets the executable conditions, and then the interactive simulation command is executed; if the interactive simulation command still does not meet the executable conditions after the preset waiting time has expired, the test is determined to be a failure and a screenshot of the tested page is taken and reported.

[0081] The reachability detection result refers to the detection result indicating whether the interactive element targeted by the interactive simulation command meets the executable conditions. For example, the detection result is "the element exists and is visible and clickable".

[0082] Executable conditions refer to the state conditions that an interactive element should meet to accept user interaction operations, including at least one of the following: the interactive element exists in the document object model, the interactive element is not hidden, the width and height of the interactive element are greater than zero, the interactive element is within the viewport, and the interactive element is not obscured.

[0083] Interactive elements exist in the Document Object Model (DOM) because the target element has been parsed by the page and mounted into the DOM tree, and can be retrieved using a selector. For example, `document.querySelector('#submit-btn')` returns a non-empty node.

[0084] Interactive elements are not hidden if their computed styles are not set to `none`, `visibility` is not set to `hidden`, and `opacity` is not zero. For example, a button in a pop-up with `display:none` is considered hidden.

[0085] An interactive element's width and height must be greater than zero, meaning that both the element's layout dimensions (width and height) are greater than zero pixels. For example, a placeholder element that has not yet been rendered and has zero width and height does not meet this condition.

[0086] An interactive element is considered to be within the viewport range if its bounding box intersects with the browser viewport and is not outside the viewport. For example, a button that requires scrolling to be visible does not meet this condition when the page is not scrolled.

[0087] Interactive elements are considered unobstructed if the topmost element of the element is itself or its child elements, and it is not covered by other overlays or pop-ups. For example, a button covered by a loading overlay does not meet this condition.

[0088] Specifically, reachability testing can be performed before the test side issues the interaction simulation command. Alternatively, the target application can automatically perform reachability testing after receiving the interaction simulation command. Reachability testing verifies the state of interactive elements within the script context of the page under test using script evaluation commands. This includes checking whether the interactive element exists in the document object model, whether it is not hidden, whether its width and height are greater than zero, whether it is within the viewport, and whether it is unobstructed. After completing the reachability testing, the result is obtained, which is used to determine whether the interaction simulation command meets the corresponding executable conditions.

[0089] When an interactive simulation command meets the corresponding executable conditions, it is issued and executed. If the interactive simulation command does not meet the executable conditions, a "loop detection and waiting" process is implemented. This involves repeatedly performing reachability checks within a preset waiting time, continuously verifying the element's status, and obtaining the reachability check results until the executable conditions are met, at which point the interactive simulation command is executed. If the preset waiting time exceeds the preset time limit and the interactive simulation command still does not meet the executable conditions, the test case is deemed a failure. Simultaneously, a screenshot of the currently tested page is captured and reported to the testing side.

[0090] In one example, this implementation can be applied to an automated testing scenario for a Hypertext Markup Language (HMR) activity gameplay page in a game engine. The test case requires clicking the "claim-btn" button. Before issuing the click command, the tester performs the following checks via a script evaluation command: confirming the element exists in the Document Object Model (DOM), confirming the element is not hidden, confirming the element's width and height are both greater than zero and within the viewport, and confirming the element is not obstructed. If the page is playing a prize-claiming animation and the button is covered by a semi-transparent overlay during the check, the "no obstruction" condition is not met. The tester polls every 100 milliseconds until a 3-second timeout occurs. After the animation ends and the overlay disappears, the test passes, and the tester issues an interaction simulation command. If the overlay does not disappear after 3 seconds, the test case is considered a failure, and a screenshot API is called to report the failure.

[0091] This embodiment performs multi-dimensional reachability detection on interactive elements and supports two execution timings. Combined with polling and timeout mechanisms, it reduces false alarms and failures caused by asynchronous page rendering timing issues. Screenshot reporting preserves the page's current state, facilitating rapid problem location and improving the stability and troubleshooting efficiency of automated testing of embedded web pages within the application.

[0092] Please see Figure 4 In some embodiments, the testing method for applying embedded web pages further includes: Step 018: When it is necessary to drive the target application to perform test operations outside the embedded web page window, or when the page under test is located in a lightweight browser kernel within a process that does not support remote debugging protocols, call the preset debugging interface built into the target application to control the target application to perform the corresponding test operations.

[0093] Test operations outside of embedded webpage windows refer to operations that require driving the target application's own state or native functions, which cannot be directly completed through the browser kernel's remote debugging protocol. Examples include opening a native panel in a game, triggering game management commands, and controlling character movement.

[0094] In-process lightweight browser kernels refer to lightweight browser kernels that run embedded in the memory of the target application process. These kernels do not support remote debugging protocols and do not expose debugging ports. For example, the Miniblink kernel.

[0095] Specifically, when test cases require the target application to perform test operations outside of embedded windows (such as opening a panel or triggering game management commands), or when the page under test is located in a lightweight in-process browser kernel that does not support remote debugging protocols, the testing side can call the target application's built-in preset debugging interface to indirectly control the target application to perform the corresponding test operations. For pages under test running on a lightweight in-process browser kernel, since there is no debugging port, the testing side indirectly reads page and control information and completes test operations through the structure query and script execution capabilities provided by the preset debugging interface.

[0096] In some embodiments, the built-in preset debugging interface includes a JavaScript bridging channel or an HTTP testing service.

[0097] The JavaScript bridging channel refers to a bidirectional communication bridge between the web page script and the native functions of the host application. The test side can call the native functions of the host application through this channel. For example, the native function to open the panel in the game can be called via the JavaScript bridging channel.

[0098] HTTP testing services refer to Hypertext Transfer Protocol services that listen inside the target application process, exposing viewing and control interfaces. For example, an HTTP service running on port 9901 provides interfaces for querying game object structure trees, modifying entity attributes, executing scripts, and taking screenshots.

[0099] In one example, this embodiment can be applied to automated testing scenarios for Hypertext Markup Language (HMR) activity gameplay pages in game engines. Test cases require pre-processing on the game client's native side, such as switching game character identities, opening the activity entry panel, and modifying simulated backend parameters. At this point, the test side calls the game client's built-in HTTP testing service to issue commands to complete native client operations such as character switching and opening the activity panel. For activity pages running on a lightweight in-process browser kernel, the test side uses a JavaScript bridge channel to call native functions to obtain the page control structure tree and complete the testing operations.

[0100] This embodiment covers application-side operations that cannot be reached by remote debugging protocols and lightweight browser kernel scenarios without debugging ports through a preset debugging interface, achieving dual kernel coverage and expanding the applicability of the testing solution.

[0101] Please continue reading. Figure 3 In some embodiments, the testing method for applying embedded web pages further includes: Step 019: If there are no debuggable pages, no page under test, or the debugging connection is broken, obtain each debuggable page again through the enumeration interface; Step 020: If the test command times out, take a screenshot of the page under test and report an error.

[0102] In this context, "no debuggable pages" means that the target enumeration interface returns an empty target list, indicating that there are currently no pages available for debugging connections to attach to. For example, accessing / json before the embedded webpage window has been created returns an empty list.

[0103] "No page under test" means the target enumeration interface returns a non-empty target list, but there is no page in it that matches the preset title or address. For example, the list only contains the "Settings" page, and there is no page under test with the title "Activity Center".

[0104] Specifically, when there is no debuggable page (i.e., the target enumeration interface returns an empty list), no page under test (i.e., the target enumeration interface returns no target page matching the preset title or address), or the debugging connection is broken, the test side re-obtains the list of debuggable pages through the target enumeration interface and retryes the connection operation. When the test command execution times out, the test side takes a screenshot of the page under test and marks the test case as failed.

[0105] In some embodiments, when the debug port is not open (i.e., non-development mode), the test side switches to performing tests only through the preset debug interface (JavaScript bridging channel or HTTP test service) and does not perform remote debug protocol operations.

[0106] In one example, this implementation can be applied to an automated testing scenario for a Hypertext Markup Language (HMR) activity / gameplay page in a game engine. Upon startup, the test side immediately accesses http: / / 127.0.0.1:9223 / json, but the game process has not yet completed initialization, so an empty list is returned. The test side retryes every second. Within 30 seconds, the game loads and creates an embedded webpage window. On the 12th retry, a target titled "Activity Center" appears in the list. The test side then extracts the debug connection address and establishes a connection.

[0107] In another example, this embodiment can be applied to automated testing scenarios for Hypertext Markup Language (HMR) activity gameplay pages in game engines. During test execution, if the game process crashes and restarts, the debugging connection is lost. After the test side captures the disconnection event, it re-accesses the enumerated target interface, reattaches the page under test, and continues executing subsequent test cases.

[0108] In another example, this embodiment can be applied to automated testing scenarios for Hypertext Markup Language (HML) activity gameplay pages in game engines. If no response is received within 10 seconds after a click command is issued, the tester determines that the command has timed out, captures an image of the current page using a screenshot command, marks the test case as failed, and attaches the screenshot to the test report.

[0109] In another example, this embodiment can be applied to automated testing scenarios for Hypertext Markup Language (HMR) activity gameplay pages in game engines. In non-development mode, debug port 9223 is not open, and the testing side automatically switches to querying the game-side control structure via an HTTP testing service to complete the testing operation.

[0110] This embodiment ensures that the testing framework will not fail due to single points of failure during long-term operation, thus improving the robustness of automated testing.

[0111] Please continue reading. Figure 3 In some embodiments, the testing method for applying embedded web pages further includes: Subscribe to the browser kernel for creation events that represent the creation of web page views; During testing, debuggable pages are determined based on the event notification received corresponding to the creation event.

[0112] Among them, the webpage view creation event refers to the event notification actively pushed by the browser kernel when a new page target is created in an embedded webpage window. For example, the Target.targetCreated event contains information such as the title, address, and debugging link address of the new target.

[0113] Event notifications refer to messages that the browser kernel actively pushes to the test side through the debug connection. These messages do not correspond to requests from the test side and do not need to be initiated by the test side.

[0114] Specifically, after establishing a debug connection, the test side sends a subscription command to the browser kernel to subscribe to the webpage view creation event. During the test, when the target application needs to create a new embedded webpage window (such as clicking a button to pop up a new webpage window), the browser kernel actively pushes an event notification of the webpage view creation event to the test side. After receiving the event notification, the test side extracts the information of the new page, determines that the new page is a debuggable page, and extracts its debug connection address to establish a new debug connection, thereby achieving dynamic discovery and attachment at runtime.

[0115] In some embodiments, if the browser kernel version of the target application is incompatible with the target browser framework, step 018 is executed; if the browser kernel version of the target application is compatible with the target browser framework, a debug connection can be established and test commands can be issued using the target browser framework (such as connectOverCDP of the official Playwright / Puppeteer framework).

[0116] Among them, the Playwright / Puppeteer framework is a browser automation testing framework based on the CDP protocol, providing a call port for web page automation testing.

[0117] connectOverCDP is an interface provided for the Playwright framework, used to connect to an externally running browser kernel instance based on the CDP debugging address and establish a remote debugging connection.

[0118] In some embodiments, for in-process lightweight browser kernels with unopened debugging ports, in addition to testing solutions using JavaScript bridging channels or HTTP testing services, an alternative implementation method can be adopted: injecting a lightweight debugging proxy on the kernel side. However, this implementation method requires corresponding modifications to the kernel host program to complete the injection and loading of the lightweight debugging proxy.

[0119] In one example, this implementation can be applied to automated testing of a Hypertext Markup Language (HMR) activity gameplay page in a game engine. After the test side establishes a debug connection with the existing activity page when the game starts, it sends the `Target.setDiscoverTargets` command to subscribe to target discovery events. During test case execution, clicking the "View Leaderboard" button dynamically creates a new embedded webpage window within the game to load the leaderboard page. The browser kernel actively pushes a `Target.targetCreated` event notification, including the new target event title "Leaderboard," the address, and the debug connection address `ws: / / 127.0.0.1:9223 / devtools / page / DEF456`. Upon receiving the event notification, the test side automatically extracts the debug connection address and establishes a new debug connection, executing test commands on the leaderboard page in parallel. If the browser's kernel version is older or the official Playwright framework connection fails, the test side automatically switches to a self-developed lightweight client, calls the target application's built-in preset debug interface, sends JSON remote call messages via a full-duplex communication connection, and adapts to the host kernel version to complete the test.

[0120] This embodiment enables the test side to discover dynamically created embedded web page windows in real time through event subscription, eliminating the need for repeated polling of the target enumeration interface. This results in timely response and low resource consumption. It is suitable for targets that are dynamically created during runtime. Furthermore, the self-developed debugging client layer complements the general automation framework, ensuring development efficiency and compatibility.

[0121] In some embodiments, the testing method for in-app embedded web pages also includes a game testing facade and a testing suite.

[0122] The GamePage is an aggregated access point for upper-level test cases, aggregating various entry points such as UI elements, interactive dialogues, and game characters. It's used to perform test operations on the page under test (which contains an embedded webpage window) and to uniformly orchestrate scenarios where the page under test resides within a lightweight browser kernel that doesn't support remote debugging protocols. This shields test cases from the implementation differences between the webpage-side debugging chain and the game client's native control chain.

[0123] The test suite is a collection of test cases written based on the game test facade and the underlying client layer, which can realize automated testing operations on objects such as page lifecycle, control structure, and scene data panel.

[0124] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.

[0125] In summary, the testing method for embedded web pages in this application has the following technical effects: (1) The test command is sent directly to the browser kernel through the debug connection. The browser kernel executes the command in the context of the page under test and returns the execution result. No data collection logic or test code needs to be embedded in the page under test, thus achieving non-intrusive testing.

[0126] (2) The general self-developed lightweight client directly realizes communication with the browser kernel, generates test commands according to the actual protocol version of the host kernel, and does not go through the communication module of the general framework, thus eliminating version coupling and being able to execute reliably on the old version of the host kernel.

[0127] (3) Test cases are pre-written and executed automatically, and the execution results are automatically returned and asserted. No manual operation of browser developer tools is required, and it can be integrated into the continuous integration and regression testing process. The debug connection, as a programmable channel, enables the test side to issue commands, read results, and make judgments in sequence according to the test case logic, providing a foundation for unified orchestration between the application side and the web page side.

[0128] (4) The debugging port is only enabled in development mode and is disabled by default in production environment to prevent remote debugging capabilities from being exploited in the production environment, which could lead to page data leakage or malicious control. This allows for on-demand enabling and secure control.

[0129] (5) By using the preset debugging interface, the application-side operation and lightweight browser kernel scenario that cannot be covered by the remote debugging protocol are covered, achieving dual kernel coverage and expanding the scope of application of the test solution.

[0130] (6) By issuing test commands corresponding to test cases, the reachability of elements can be confirmed before interaction, thereby reducing the probability of random failure of test cases and improving stability and accuracy.

[0131] To facilitate better implementation of the application-embedded webpage testing method of this application embodiment, this application embodiment also provides an application-embedded webpage testing apparatus. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the structure of a testing device for embedded web pages provided in an embodiment of this application. The testing device 100 for embedded web pages may include: Connection module 101 is used to establish a debugging connection with the page loaded by the target application in the embedded web page window; Test module 102 is used to send test commands to the target application. The test commands are used to control the embedded web page window to perform corresponding test operations. The test commands are adapted to the browser kernel protocol of the target application. Output module 103 is used to output the test results after performing test operations on the page under test.

[0132] The modules or units in the aforementioned test device for embedded web pages can be implemented entirely or partially through software, hardware, or a combination thereof. These units can be embedded in or independent of the processor in the electronic device in hardware form, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to these units.

[0133] The application-embedded webpage testing device 100 can be integrated into a terminal or server that has memory and a processor and thus computing power, or the application-embedded webpage testing device 100 can be the terminal or server.

[0134] Optionally, this application also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0135] Figure 6 This is a schematic diagram of the structure of an electronic device 200 provided in an embodiment of this application. The electronic device 200 can be a terminal or a server. Figure 6 As shown, the electronic device 200 includes a processor 201 having one or more processing cores, a memory 202 having one or more computer-readable storage media, and a computer program stored in the memory 202 and executable on the processor. The processor 201 and the memory 202 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0136] The processor 201 is the control center of the electronic device 200. It connects various parts of the electronic device 200 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 202, and calling data stored in the memory 202, it executes various functions of the electronic device 200 and processes data, thereby performing overall processing of the electronic device 200.

[0137] Optionally, such as Figure 6 As shown, the electronic device 200 also includes: a display screen 203, a radio frequency circuit 204, an audio circuit 205, an input unit 206, and a power supply 207. The processor 201 is electrically connected to the display screen 203, the radio frequency circuit 204, the audio circuit 205, the input unit 206, and the power supply 207. Those skilled in the art will understand that... Figure 6 The structure of the electronic device 200 shown does not constitute a limitation on the electronic device 200, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0138] The display screen 203 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The display screen 203 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various GUIs of the electronic device 200. These GUIs can be composed of graphics, text, icons, video, and any combination thereof. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program. Optionally, the touch panel may include a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 201, and can also receive and execute commands from the processor 201. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 201 to determine the type of touch event. Subsequently, the processor 201 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the display screen 203 to achieve input and output functions. However, in some embodiments, the touch panel and the display panel can be implemented as two independent components to achieve input and output functions. That is, the display screen 203 can also be used as part of the input unit 206 to achieve input functions.

[0139] The radio frequency circuit 204 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.

[0140] Audio circuitry 205 can be used to provide an audio interface between a user and an electronic device via a speaker and microphone. Audio circuitry 205 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 205, converted back into audio data, and then processed by processor 201 before being transmitted via radio frequency circuitry 204 to, for example, another electronic device, or output to memory 202 for further processing. Audio circuitry 205 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.

[0141] The input unit 206 can be used to receive input numbers, characters, or object feature information (such as fingerprints, irises, facial information, etc.), and to generate input signals such as keyboard, mouse, joystick, optical, or trackball signals related to user settings and function control.

[0142] Power supply 207 is used to supply power to various components of electronic device 200. Optionally, power supply 207 can be logically connected to processor 201 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 207 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0143] although Figure 6 As not shown in the diagram, the electronic device 200 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0144] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to an electronic device 200, and the computer program causes the electronic device 200 to execute the corresponding process in the application-embedded webpage testing method of the embodiments of this application; for the sake of brevity, further details are omitted here.

[0145] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. The processor of the electronic device 200 reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device 200 to perform the corresponding process in the application-embedded webpage testing method of this application embodiment. For simplicity, further details are omitted here.

[0146] It should be understood that the processor in this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as the processor hardware logic being executed, or as a combination of hardware and software modules in the processor being executed. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0147] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0148] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0149] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0150] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0151] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

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

[0153] In addition, the functional units in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

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

[0155] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A testing method for embedded web pages, characterized in that, include: Establish a debug connection with the page loaded by the target application in an embedded webpage window; A test command is sent to the target application. The test command is used to control the embedded web page window to perform the corresponding test operation. The test command is adapted to the browser kernel protocol of the target application. The test results are output based on the execution results of the test operation performed on the page under test.

2. The testing method for embedded web pages according to claim 1, characterized in that, The method further includes: After the embedded webpage window loads the initial page, the target page address of the page under test that matches the preset title or address is obtained from each debuggable page of the target application through the preset enumeration interface of the debugging port. The test command includes a navigation command, and sending the test command to the target application includes: The navigation command is sent to the target application to control the embedded webpage window to load the page under test corresponding to the target page address.

3. The testing method for embedded web pages according to claim 2, characterized in that, Before establishing the debugging connection, the method further includes: In development mode, the debug port number is written to a preset environment variable through the interface provided by the application engine. When the browser kernel starts, it reads the preset environment variable to enable the debug port.

4. The testing method for embedded web pages according to claim 2, characterized in that, When the browser kernel starts, it reads the debug port number to enable the debug port. The debug port number is passed to the browser kernel via command-line parameters or runtime configuration files.

5. The testing method for embedded web pages in applications according to claim 1 or 2, characterized in that, The test commands also include at least one of the following: document object model operation commands, script evaluation commands, interactive simulation commands, and screenshot commands.

6. The testing method for embedded web pages according to claim 1, characterized in that, The test commands include interactive simulation commands, and the method further includes: Obtain the reachability detection result of the interactive simulation command. The reachability detection result includes whether the interactive simulation command meets the corresponding executable conditions. The executable conditions include at least one of the following conditions: the interactive element exists in the document object model, the interactive element is not hidden, the width and height of the interactive element are greater than zero, the interactive element is within the viewport range, and the interactive element is not occluded. Sending the test command to the target application includes: If the interaction simulation command meets the corresponding executable conditions, the interaction simulation command is executed; wherein, the reachability detection result is obtained by the test side before issuing the interaction simulation command, or by the target application after receiving the interaction simulation command; If the interactive simulation command does not meet the executable condition, the reachability detection result is obtained in a loop within a preset waiting time until the interactive simulation command meets the executable condition, and then the interactive simulation command is executed; if the interactive simulation command still does not meet the executable condition after the preset waiting time has elapsed, the test is determined to have failed and a screenshot of the tested page is taken and reported.

7. The testing method for embedded web pages according to claim 1, characterized in that, Both the test command and the execution result are JSON remote call messages.

8. The testing method for embedded web pages according to claim 1, characterized in that, The method further includes: When it is necessary to drive the target application to perform test operations outside the embedded web page window, or when the page under test is located in a lightweight browser kernel within a process that does not support remote debugging protocols, the preset debugging interface built into the target application is called to control the target application to perform the corresponding test operations.

9. The testing method for embedded web pages according to claim 2, characterized in that, The method further includes: If the debuggable page does not exist, the page under test does not exist, or the debugging connection is broken, the debuggable page is retrieved again through the enumeration interface; If the test command times out, take a screenshot of the page being tested and report an error.

10. The testing method for embedded web pages according to claim 9, characterized in that, The method further includes: Subscribe to the browser kernel for creation events that represent the creation of webpage views; During testing, the debuggable page is determined based on the event notification received corresponding to the creation event.

11. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing a computer program, and the processor executes the application-embedded webpage testing method according to any one of claims 1-10 by calling the computer program stored in the memory.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the test method for embedded web pages as described in any one of claims 1-10.