CN109753425B - Popup window processing method and device - Google Patents

Popup window processing method and device Download PDF

Info

Publication number
CN109753425B
CN109753425B CN201711077207.9A CN201711077207A CN109753425B CN 109753425 B CN109753425 B CN 109753425B CN 201711077207 A CN201711077207 A CN 201711077207A CN 109753425 B CN109753425 B CN 109753425B
Authority
CN
China
Prior art keywords
window
target application
address
application program
main process
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711077207.9A
Other languages
Chinese (zh)
Other versions
CN109753425A (en
Inventor
程春林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201711077207.9A priority Critical patent/CN109753425B/en
Publication of CN109753425A publication Critical patent/CN109753425A/en
Application granted granted Critical
Publication of CN109753425B publication Critical patent/CN109753425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a popup window processing method and device. The method comprises the following steps: when a target application program is tested, a main process address and a sub process address of the target application program can be obtained, a window event in the target application program is monitored through the main process address, and when first attribute information of a window corresponding to the monitored window event indicates that the window is a popup window, preset processing is executed on the window. When a target application program is tested, whether the target application program is currently processing a window can be automatically monitored according to the process address of the target application program, the attribute of the window currently being processed by the target application program is further obtained, whether the window currently being processed is a popup window is judged according to the attribute of the window, and a tester does not need to add an attribute template of the popup window in the test script in advance, so that the development efficiency of the test script and the test efficiency of the application program are improved.

Description

Popup window processing method and device
Technical Field
The invention relates to the technical field of software testing, in particular to a popup window processing method and device.
Background
The popup window refers to a window which pops up automatically when an operating system interface or an application interface is opened. In the software automation test process, in order to enable the automation test process to be smoothly performed, the test script generally needs to identify the popup event and perform corresponding processing in the test process.
In the related art, a tester can manually determine pop-ups which may appear in an application program to be tested, and adds codes for identifying and processing the pop-ups into a test script, so that the test script can be identified and processed in time when the pop-ups pop up in the running process. Specifically, a tester manually preset an attribute template of a popup which may appear in a test script, detects whether the attribute information of the currently displayed object matches the preset attribute template of the popup in the test process, determines that the currently displayed object is the popup if the attribute information of the currently displayed object matches the preset attribute template of the popup, and performs predetermined processing on the popup.
In the related art, a tester needs to manually determine popup windows which may appear in an application program, and add an attribute template of the popup window to a test script, which affects development efficiency of the test script and test efficiency of the application program.
Disclosure of Invention
The embodiment of the invention provides a popup processing method and a popup processing device, which can solve the problems that in the related art, testers need to manually determine popup which may appear in an application program, and a popup template is added in a test script, so that the development efficiency of the test script and the test efficiency of the application program are influenced, and the technical scheme is as follows:
in one aspect, a pop-up window processing method is provided, where the method includes:
when a target application program is tested, acquiring a main process address and a subprocess address of the target application program, wherein the main process address is a code block address of a main process for realizing the target application program, and the subprocess address is a code block address of a subprocess for realizing the target application program;
monitoring a window event in the target application program through the main process address, wherein the window event indicates that the target application program is processing a window object;
acquiring first attribute information of a window corresponding to the window object through the subprocess address, wherein the first attribute information indicates whether the window is a popup window;
and when the first attribute information indicates that the window is a popup window, executing predetermined processing on the window.
In another aspect, there is provided a pop-up window processing apparatus, the apparatus including:
the system comprises an address acquisition module, a test module and a test module, wherein the address acquisition module is used for acquiring a main process address and a subprocess address of a target application program when the target application program is tested, the main process address is a code block address of a main process for realizing the target application program, and the subprocess address is a code block address of a subprocess for realizing the target application program;
the event monitoring module is used for monitoring a window event in the target application program through the main process address, wherein the window event indicates that the target application program is processing a window object;
a first attribute obtaining module, configured to obtain first attribute information of a window corresponding to the window object through the subprocess address, where the first attribute information indicates whether the window is a popup window;
and the processing module is used for executing preset processing on the window when the first attribute information indicates that the window is a popup window.
Optionally, the address obtaining module includes:
the first address acquisition unit is used for acquiring a program instance object of the target application program and acquiring the main process address corresponding to the program instance object by calling a preset interface;
and the second address acquisition unit is used for acquiring the element instance object of the target application program and acquiring the subprocess address corresponding to the element instance object by calling the preset interface.
Optionally, the event monitoring module includes:
the attribute acquisition unit is used for acquiring second attribute information of the object being processed by the target application program according to the main process address, wherein the second attribute information indicates whether the object being processed by the target application program is a window object;
and the event determining unit is used for determining that the window event is monitored when the second attribute information indicates that the object being processed by the target application program is a window object.
Optionally, the apparatus further comprises:
a second attribute obtaining module, configured to obtain a visualization attribute of the window before the processing module performs a predetermined process on the window, where the visualization attribute indicates whether a corresponding window is visible;
the processing module is configured to execute the step of executing the predetermined processing on the window when the visualization attribute of the window indicates that the window is visible.
Optionally, the processing module includes:
the button determining unit is used for traversing each button contained in the window and determining a window closing button in each button;
and the simulated clicking unit is used for simulating and clicking the window closing button.
Optionally, the apparatus further comprises:
the information acquisition module is used for acquiring the main process information of the target application program before the address acquisition module acquires the main process address and the subprocess address of the target application program, wherein the main process information comprises the version information of an operating system;
the address obtaining module is configured to execute the step of obtaining the main process address and the sub-process address of the target application program when the version information of the operating system indicates that the version of the operating system is not lower than a preset version.
In a further aspect, there is provided a computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by the processor to implement the pop-window processing method as described in the first aspect above.
In a further aspect, there is provided a computer readable storage medium having stored therein at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement the pop-window processing method according to the first aspect.
The technical scheme provided by the invention can have the following beneficial effects:
when a target application program is tested, whether the target application program is currently processing a window can be automatically monitored according to the process address of the target application program, the attribute of the window currently being processed by the target application program is further obtained, whether the window currently being processed is a popup window is judged according to the attribute of the window, and a tester does not need to add an attribute template of the popup window in the test script in advance, so that the development efficiency of the test script and the test efficiency of the application program are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a basic flow diagram illustrating a pop-up process in accordance with an exemplary embodiment of the present invention;
FIG. 2 is a flowchart of a pop-up process in the iOS system according to the embodiment shown in FIG. 1;
FIG. 3 is a flow chart illustrating a pop-up window processing method in accordance with an exemplary embodiment of the present invention;
FIG. 4 is a flow diagram illustrating a method of pop-window processing in an iOS system in accordance with an illustrative embodiment of the present invention;
FIG. 5 is a block diagram illustrating the structure of a pop-up window processing apparatus according to an exemplary embodiment;
FIG. 6 is a schematic diagram illustrating a configuration of a computer device in accordance with an illustrative embodiment;
FIG. 7 is a block diagram illustrating a computer device according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings.
The method disclosed by the embodiment of the invention can be applied to various test terminals, wherein the test terminal can be a terminal running with a test script, and the test script is used for carrying out automatic test on an operating system in the test terminal or an application program running based on the operating system. The test terminal can be a mobile terminal such as a smart phone, a tablet computer or an electronic book reader, or can be an intelligent wearable device such as a smart watch or smart glasses, or can be a computer device such as a notebook computer, a desktop computer or a personal workstation.
The method disclosed by the embodiment of the invention can be used for identifying and processing the popup window popped up in the system or application currently tested when the test terminal runs the test script. Specifically, the method shown in the embodiment of the present invention may be implemented by the test terminal running the test script, or the method shown in the embodiment of the present invention may also be implemented by other applications, plug-ins, or system components besides the test terminal running the test script.
FIG. 1 is a basic flow diagram illustrating a pop-up process in accordance with an exemplary embodiment. As shown in fig. 1, in the embodiment of the present invention, when a test script is run by a test terminal to test a target application program, a main process address and a sub process address of the target application program may be obtained, a window event in the target application program is monitored through the main process address, when the monitored window event is detected, first attribute information of a window corresponding to the window event is obtained through the sub process address, and when the first attribute information indicates that the window is a popup window, predetermined processing is performed on the window. That is, in the embodiment of the present invention, when a target application is tested, whether the target application is currently processing a window may be automatically monitored according to the process address of the target application, the attribute of the window currently being processed by the target application is further obtained, and whether the window currently being processed is a popup window is determined according to the attribute of the window, and a tester does not need to add an attribute template of the popup window in a test script in advance, so that the development efficiency of the test script and the test efficiency of the application are improved.
In a possible implementation manner, the embodiment of the invention can rapidly and automatically identify the popup event in the automatic test process based on the iOS system, and then accurately process the popup, so that the execution of the automation program and other works cannot be influenced.
Specifically, for example, taking an application to an iOS system to perform an automated test on an app, please refer to fig. 2, which shows a pop-up window processing flow chart in the iOS system according to an embodiment of the present invention, and as shown in fig. 2, the pop-up window processing flow in the iOS system is as follows:
1) the test terminal acquires UIATarget and UIElement of the currently tested app. The UIATarget defines an application instance object in the iOS system, the UIElement defines an element instance object of the application in the iOS system, for example, taking app as an example of a certain browser application, the UIATarget defines an instance object of the whole browser application, the UIElement defines a specific element (for example, the specific element may be a page or a button in the page, etc.) in the browser application, and the UIElement corresponds to a carrier of a UI (User Interface) element in the app. One app corresponds to one UIElement, namely the UI elements processed by the UIElement are variable, and the UI elements processed at different times can be different.
2) The test terminal acquires an IMP address (marked as IMP _ A and corresponding to the main process address) of UIATarget and acquires an IMP address (marked as IMP _ U and corresponding to the sub-process address) of UIElement. The IMP is the address of the implementation code block of the method Object-C of the application program in the iOS system, the IMP can be called directly like a C language function, and can send a message to an Object in a mode of Object method or Object _ msgSend () in general, and then the Objective-C runtime looks for the IMP matching the message and calls the IMP, or Objective-C can also directly acquire the IMP and call the IMP.
3) When the test terminal monitors the window event currently processed by the app through the IMP _ A, the first attribute information of the window corresponding to the currently processed window event is obtained through the IMP _ U, and whether the window event is a popup window is judged according to the first attribute information of the window.
4) And when the test terminal determines that the window is the popup window according to the first attribute information of the window, executing preset processing on the popup window.
The following embodiments of the present invention will describe the scheme shown in fig. 1 by taking an os as an example.
Fig. 3 is a flow diagram illustrating a pop-up window processing method that may be used in a test terminal according to an example embodiment. The pop-up window processing method can comprise the following steps:
step 301, the test terminal runs a test script to perform an automated test on the target application program.
When testing the app in the iOS system, the test terminal may run an automated test script for the app, which is a target application program.
Step 302, the test terminal obtains main process information of the target application program, and obtains sub-process information of the target application program according to the main process information.
When the test terminal runs the automatic test script, the process information M of the main process of the currently tested app can be obtained, and the sub-process information U of the app is obtained according to the process information M.
The process information M may include an ID (identity) of the main process, an ID of the sub-process, a memory address of the main process, an entry function of the main process, and the like. The sub-process information U may include an ID of the sub-process, a memory address of the sub-process, an entry function of the sub-process, and the like.
When the main process information and the sub process information of the target application program are obtained, the test terminal may obtain the process information M according to the program name of the currently tested app, and obtain the sub process information U according to the process information M (specifically, according to the sub process ID in the process information M).
Step 303, the test terminal obtains version information of the operating system according to the main process information.
In the iOS system, the process information M may also directly include the current version information of the iOS system, i.e., the test terminal may directly extract the version information of the iOS from the process information M.
And 304, when the version information of the operating system indicates that the version of the operating system is not lower than the preset version, the test terminal acquires the main process address and the sub-process address of the target application program.
The main process address is a code block address of a main process for realizing the target application program, and the subprocess address is a code block address of a subprocess for realizing the target application program.
In practical applications, for the same operating system, not all operating system versions may be able to support the method shown in fig. 1, and therefore, in the embodiment of the present invention, when testing a target application program, it may be first determined whether a current operating system version is the version of the method shown in fig. 1. The preset version can be set in the test script by a developer/tester in advance.
In the embodiment of the present invention, for the iOS system, the preset version may be 9.0 version of iOS, that is, when the operating system version is 9.0 and 9.0 or more, step 304 is executed.
When the main process address is obtained, the test terminal can obtain a program instance object of the target application program, and obtain the main process address corresponding to the program instance object by calling a preset interface.
In the embodiment of the present invention, the test terminal may obtain the program instance object of the currently tested app according to the main process information, and directly call a preset system interface to obtain the main process address corresponding to the program instance object according to the program instance object. The preset system interface is an interface provided by an operating system and used for acquiring information related to the instance object, for example, in an iOS system, the preset system interface may be a method _ getImplementation interface.
Specifically, taking an iOS system with a version of 9.0 or more as an example, the test terminal may obtain the program instance object UIATarget of the app according to the process information M, for example, the test terminal may obtain the program instance object UIATarget of the app according to an ID of a main process in the process information M or an entry function of the main process. After obtaining the UIATarge, the test terminal may obtain, according to the UIATarge, IMP address information IMP _ a of the UIATarge by calling a preset system interface method _ getImplementation, where the IMP _ a is the main process address.
When the subprocess address is obtained, the test terminal can obtain the element instance object of the target application program, and obtain the subprocess address corresponding to the element instance object by calling the preset interface.
In the embodiment of the present invention, the test terminal may obtain the element instance object of the currently tested app according to the sub-process information, and directly call a preset system interface to obtain the sub-process address corresponding to the element instance object according to the element instance object.
Specifically, taking an iOS system with a version of 9.0 or more as an example, the test terminal may obtain the element instance object UIElement of the app according to the sub-process information U, for example, the test terminal may obtain the element instance object UIElement of the app according to an ID of a sub-process in the sub-process information U or an entry function of the sub-process. After the UIElement is obtained, the test terminal may obtain IMP address information IMP _ U of the UIElement by calling a preset system interface method _ getImplementation according to the UIElement, where the IMP _ U is the sub-process address.
In step 305, the test terminal listens for the main process address and the sub-process address.
In the embodiment of the present invention, after acquiring the main process address and the sub-process address, the test terminal may monitor the main process address and the sub-process address through a Hook (e.g., Hook) program. Hook is a technology for performing monitoring or interception processing on a program by exchanging program address information.
Specifically, for example, in an iOS system with a version of 9.0 or more, the test terminal may hold the entries of the two address information, i.e., IMP _ a and IMP _ U, through an automation process hook to register and monitor the two address information, i.e., IMP _ a and IMP _ U.
Step 306, the test terminal monitors the window event in the target application program through the main process address.
The test terminal can obtain second attribute information of the object being processed by the target application program according to the main process address, wherein the second attribute information indicates whether the object being processed by the target application program is a window object; and when the second attribute information of the object being processed by the target application program indicates that the object being processed by the target application program is a window object, determining that the window event is monitored. Wherein the window event is used to indicate that the object currently being processed by the target application is a window object.
Specifically, in an iOS system with a version of 9.0 or more, the test terminal may automatically and cyclically monitor the IMP _ a through a Hook program, and when it is monitored that an object in the uiage changes, for example, a new object appears, the test terminal may obtain second attribute information of the object in the uiage by calling method _ getImplementation, and determine whether the object in the uiage (i.e., an object currently processed by the app) is a window object according to the second attribute information of the object in the uiage, and if so, it is described that a window event in the app is monitored.
Step 307, when the window event is monitored, the test terminal obtains first attribute information of the window corresponding to the window object through the subprocess address, and the first attribute information indicates whether the window is a popup window.
When a window event is monitored, the test terminal can obtain first attribute information of an element in an element instance object (namely, a window corresponding to the window event) through the subprocess address, wherein the first attribute information of the window comprises indication information used for indicating whether the window is a popup window.
Specifically, in the iOS system of version 9.0 or more, when the test terminal monitors the window event, the accessibility label of the window in the UIElement may be obtained through the IMP _ U, where the accessibility label includes the attribute level of the window, and the attribute level may indicate whether the window is a popup window.
Step 308, the test terminal determines whether the window is a popup window according to the first attribute information of the window, if so, step 309 is entered, otherwise, step 305 is returned.
Specifically, in an iOS system with version 9.0 or more, the test terminal may determine whether the attribute level of the window is Alert, if so, go to step 309, otherwise, return to step 305 to continue monitoring. Where Alert is an attribute level of a window in an iOS system, indicating that the current window is a pop-up prompt/Alert type dialog, i.e., a pop-up window.
In step 309, the test terminal determines whether the window is visible, if so, step 310 is entered, otherwise, step 305 is returned to.
In practical applications, some popup windows may be invisible to the user, and for the popup windows invisible to the user, the progress of the automated test is generally not affected, and for the popup windows invisible to the user, the test terminal may not process the popup windows. In this regard, after the test terminal determines that the window is a popup window, the visual attribute of the window can be acquired, and the visual attribute indicates whether the corresponding window is visible; when the visualization property of the window indicates that the window is visible, the test terminal performs step 312, otherwise, returns to step 307.
Specifically, in an iOS system with a version of 9.0 or more, if the test terminal determines that the window is a popup window, the test terminal further obtains a visibility isVisible attribute of the window, if the isVisible attribute indicates that the window is a visible window, the process proceeds to step 310, otherwise, the process returns to step 305 to continue monitoring.
In step 310, the test terminal performs predetermined processing on the window, and returns to step 305.
In the embodiment of the invention, when the test terminal determines that the window currently processed by the app is a visible popup, the window can be automatically closed. For example, the test terminal may traverse through the buttons included in the window, determine a close window button of the buttons, and simulate clicking the close window button.
Since the close window button in the window is usually the last button in the window, in the iOS system above version 9.0, if the test terminal determines that the window currently processed by the app is a visible popup, the test terminal may traverse all the buttons of the window and then automatically click the last button to destroy the current window. And then returns to step 305 to continue listening.
In summary, in the popup processing method provided in the embodiment of the present invention, when a target application is tested, whether the target application is currently processing a window may be automatically monitored according to a process address of the target application, an attribute of the window currently being processed by the target application is further obtained, and whether the window currently being processed is a popup is determined according to the attribute of the window, and a tester does not need to add an attribute template of the popup into a test script in advance, so that development efficiency of the test script and test efficiency of the application are improved;
in addition, according to the popup processing method provided by the embodiment of the invention, when the currently processed window of the target application program is identified to be the popup, whether the popup is visible or not is further identified, and if the popup is visible, the popup is subjected to predetermined processing, so that an unnecessary processing process is avoided, unnecessary processing time is saved, and thus the automatic test efficiency is improved.
In this embodiment of the present invention, for a system version that does not support the popup processing method shown in fig. 1 or fig. 3, an attribute template of a popup may be set in advance in a test script, when an automated test is performed on a target application, third attribute information of a current processing object of the target application may be obtained, and the third attribute information of the current processing object of the target application is compared with the attribute template of the popup to determine whether the current processing object of the target application is the popup, and if the third attribute information of the current processing object of the target application matches with the attribute template of the popup, it is determined that the current processing object of the target application is the popup, and predetermined processing is performed on the popup.
Fig. 4 is a flow diagram illustrating a method of pop-window processing in an iOS system in accordance with an exemplary embodiment. Taking an example of performing an automated test on an app, referring to fig. 4, the pop-window processing method may be as follows:
the test terminal acquires main process information M and sub-process information U of the app. And extracting the version information of the current iOS system from the main process information M, and judging whether the current iOS system is a system with an iOS9.0 or more than 9.0 version according to the version information of the current iOS system.
If the current iOS system is the system of iOS9.0 or more than 9.0 version, the test terminal acquires the program instance object UIATarge of the app according to the main process information M, and then acquires the IMP address of the program instance object UIATarge: the test terminal further acquires an element instance object UIElement of the app according to the subprocess information U, and then acquires an IMP address of the element instance object UIElement: IMP _ U. After a test terminal registers monitoring addresses IMP _ A and IMP _ U, monitoring the IMP _ A and IMP _ U through a Hook program, when window events are monitored through the IMP _ A, acquiring the attribute level of a window currently processed by an app through the IMP _ U, judging whether the attribute level of the window is Alert, returning to continue monitoring if the attribute level of the window is not Alert, and continuously judging whether the isVisible attribute of the window indicates that the window is visible if the attribute level of the window is Alert; if the window is visible, the test terminal traverses all buttons in the current window and simulates and clicks the last button to close the window; if the window is not visible, returning to continue monitoring.
If the current iOS system is a system of a version below iOS9.0, the test terminal obtains the AccessibilityElement attribute of the object currently processed by the app, and specifically, the test terminal can obtain the AccessibilityElement attribute of the object currently processed by the app through an automapper program carried by the iOS system. The test terminal compares the access identity element attribute of the object currently processed by the app with a preset access identity element attribute template; the AccessibilityElement attribute template may be a template preset in the test terminal by a developer/tester according to an AccessibilityElement attribute of a popup that may appear. When the test terminal determines that the AccessibilityElement attribute of the object currently processed by the app is matched with the AccessibilityElement attribute template through comparison, the object currently processed by the app can be determined to be a popup, closing processing is performed on the object (namely the popup), and the access ibityelement attribute of the object processed next by the app is obtained after the closing processing.
Fig. 5 is a block diagram illustrating a configuration of a popup processing apparatus according to an exemplary embodiment. The pop-up window processing device may be implemented as all or part of the test terminal in a software or hardware-software manner, so as to execute all or part of the steps of the method in any one of fig. 1 to 4. The pop-up window processing apparatus may include:
an address obtaining module 501, configured to obtain a main process address and a sub-process address of a target application program when the target application program is tested, where the main process address is a code block address of a main process used for implementing the target application program, and the sub-process address is a code block address of a sub-process used for implementing the target application program;
an event monitoring module 502, configured to monitor a window event in the target application through the host process address, where the window event indicates that the target application is processing a window object;
a first attribute obtaining module 503, configured to obtain first attribute information of a window corresponding to the window object through the subprocess address, where the first attribute information indicates whether the window is a popup window;
a processing module 504, configured to execute a predetermined process on the window when the first attribute information indicates that the window is a popup window.
Optionally, the address obtaining module includes:
the first address acquisition unit is used for acquiring a program instance object of the target application program and acquiring the main process address corresponding to the program instance object by calling a preset interface;
and the second address acquisition unit is used for acquiring the element instance object of the target application program and acquiring the subprocess address corresponding to the element instance object by calling the preset interface.
Optionally, the event monitoring module includes:
the attribute acquisition unit is used for acquiring second attribute information of the object being processed by the target application program according to the main process address, wherein the second attribute information indicates whether the object being processed by the target application program is a window object;
and the event determining unit is used for determining that the window event is monitored when the second attribute information indicates that the object being processed by the target application program is a window object.
Optionally, the apparatus further comprises:
a second attribute obtaining module, configured to obtain a visualization attribute of the window before the processing module performs a predetermined process on the window, where the visualization attribute indicates whether a corresponding window is visible;
the processing module is configured to execute the step of executing the predetermined processing on the window when the visualization attribute of the window indicates that the window is visible.
Optionally, the processing module includes:
the button determining unit is used for traversing each button contained in the window and determining a window closing button in each button;
and the simulated clicking unit is used for simulating and clicking the window closing button.
Optionally, the apparatus further comprises:
the information acquisition module is used for acquiring the main process information of the target application program before the address acquisition module acquires the main process address and the subprocess address of the target application program, wherein the main process information comprises the version information of an operating system;
the address obtaining module is configured to execute the step of obtaining the main process address and the sub-process address of the target application program when the version information of the operating system indicates that the version of the operating system is not lower than a preset version.
In summary, when a target application is tested, the popup processing apparatus provided in the embodiment of the present invention may automatically monitor whether the target application is currently processing a window according to the process address of the target application, further obtain the attribute of the window currently being processed by the target application, and determine whether the window currently being processed is a popup according to the attribute of the window, without requiring a tester to add an attribute template of the popup into a test script in advance, thereby improving the development efficiency of the test script and the test efficiency of the application;
in addition, the popup processing apparatus provided in the embodiment of the present invention further identifies whether the popup is visible when identifying that the currently processed window of the target application is the popup, and performs predetermined processing on the popup if the popup is visible, so as to avoid an unnecessary processing procedure, save unnecessary processing time, and thereby improve the efficiency of the automated test.
FIG. 6 is a schematic diagram illustrating a configuration of a computer device, according to an example embodiment. The computer device may be implemented as a test terminal. The computer device 600 includes a Central Processing Unit (CPU)601, a system memory 604 including a Random Access Memory (RAM)602 and a Read Only Memory (ROM)603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a basic input/output system (I/O system) 606 for facilitating information transfer between various elements within the computer, and a mass storage device 607 for storing an operating system 613, application programs 614, and other program modules 615.
The basic input/output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse, keyboard, etc. for a user to input information. Wherein the display 608 and the input device 609 are connected to the central processing unit 601 through an input output controller 610 connected to the system bus 605. The basic input/output system 606 may also include an input/output controller 610 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input/output controller 610 may also provide output to a display screen, a printer, or other type of output device.
The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer-readable media provide non-volatile storage for the computer device 600. That is, the mass storage device 607 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM drive.
Without loss of generality, the computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 604 and mass storage device 607 described above may be collectively referred to as memory.
The computer device 600 may be connected to the internet or other network devices through a network interface unit 611 connected to the system bus 605.
The memory further includes at least one instruction, at least one program, set of codes, or set of instructions that is loaded and executed by the processor to implement all or part of the steps of the method as described above with reference to any one of fig. 1-4.
Fig. 7 is a block diagram illustrating a computer device 700 according to an example embodiment. The computer device 700 may be implemented as the test terminal in the embodiment illustrated in fig. 1 described above. The computer device 700 in embodiments of the invention may include one or more of the following components: a processor for executing computer program instructions to perform the various processes and methods, Random Access Memory (RAM) and Read Only Memory (ROM) for information and storing program instructions, memory for storing data and information, I/O devices, interfaces, antennas, and the like. Specifically, the method comprises the following steps:
computer device 700 may include RF (Radio Frequency) circuitry 710, memory 720, input unit 730, display unit 740, sensor 750, audio circuitry 760, WiFi (wireless fidelity) module 770, processor 780, power supply 782, camera 790, and the like. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 7 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The various components of the computer device 700 are described in detail below with reference to FIG. 7:
the RF circuit 710 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 780; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuit 710 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, etc.
The memory 720 may be used to store software programs and modules, and the processor 780 may execute various functional applications and data processing of the computer device 700 by operating the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the computer device 700, and the like. Further, the memory 720 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 730 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computer apparatus 700. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also referred to as a touch screen, can collect touch operations of a user (e.g. operations of the user on or near the touch panel 731 by using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 731 may include two portions of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 780, and can receive and execute commands from the processor 780. In addition, the touch panel 731 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 730 may include other input devices 732 in addition to the touch panel 731. In particular, other input devices 732 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 740 may be used to display information input by the user or information provided to the user and various menus of the computer device 700. The Display unit 740 may include a Display panel 741, and optionally, the Display panel 741 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch panel 731 covers the display panel 741, and when the touch panel 731 detects a touch operation on or near the touch panel 731, the touch operation is transmitted to the processor 780 to determine the type of the touch event, and then the processor 780 provides a corresponding visual output on the display panel 741 according to the type of the touch event. Although in fig. 7, the touch panel 731 and the display panel 741 are two separate components to implement the input and output functions of the computer device 700, in some embodiments, the touch panel 731 and the display panel 741 may be integrated to implement the input and output functions of the computer device 700.
The computer device 700 may also include at least one sensor 750, such as a gyroscope sensor, a magnetic induction sensor, an optical sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 741 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 741 and/or the backlight when the computer device 700 is moved to the ear. As one type of motion sensor, the acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of a computer device, and related functions (such as pedometer and tapping) for vibration recognition; as for other sensors such as barometer, hygrometer, thermometer, infrared sensor, etc. that can be configured on the computer device 700, they will not be described in detail herein.
Audio circuitry 760, speakers 781, and microphone 762 may provide an audio interface between a user and the computer device 700. The audio circuit 760 can transmit the electrical signal converted from the received audio data to the speaker 761, and the electrical signal is converted into a sound signal by the speaker 761 and output; on the other hand, the microphone 762 converts collected sound signals into electrical signals, converts the electrical signals into audio data after being received by the audio circuit 760, processes the audio data output processor 780, and then sends the audio data through the RF circuit 710 to, for example, another computer device, or outputs the audio data to the memory 720 for further processing.
WiFi belongs to short-range wireless transmission technology, and the computer device 700 can help the user send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 770, which provides the user with wireless broadband internet access. Although fig. 7 shows WiFi module 770, it is understood that it does not belong to the essential constituents of computer device 700 and may be omitted entirely as needed within the scope of not changing the essence of the disclosure.
The processor 780 is a control center of the computer device 700, connects the respective parts of the entire computer device using various interfaces and lines, performs various functions of the computer device 700 and processes data by operating or executing software programs and/or modules stored in the memory 720 and calling data stored in the memory 720, thereby monitoring the computer device as a whole. Optionally, processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 780.
Computer device 700 also includes a power supply 782 (e.g., a battery) for supplying power to various components, which may preferably be logically connected to processor 780 through a power management system, for managing charging, discharging, and power consumption through the power management system.
The camera 790 is generally composed of a lens, an image sensor, an interface, a digital signal processor, a CPU, a display screen, and the like. The lens is fixed above the image sensor, and the focusing can be changed by manually adjusting the lens; the image sensor is equivalent to the 'film' of a traditional camera and is the heart of a camera for acquiring images; the interface is used for connecting the camera with a computer equipment mainboard in a flat cable, board-to-board connector and spring connection mode and sending the acquired image to the memory 720; the digital signal processor processes the captured image through a mathematical operation, converts the captured analog image into a digital image, and transmits the digital image to the memory 720 through the interface.
Although not shown, the computer device 700 may further include a bluetooth module or the like, which will not be described herein.
The computer device 700, in addition to one or more processors 780, includes a memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions that is loaded and executed by the processor to perform all or part of the steps of the method as described above in any one of fig. 1-4.
In an exemplary embodiment, a non-transitory computer readable storage medium including instructions, such as a memory including at least one instruction, at least one program, set of codes, or set of instructions, executable by a processor to perform all or part of the steps performed by the test terminal in any of the embodiments of fig. 1-4 of the present invention is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

Claims (10)

1. A pop-up window processing method, the method comprising:
when a target application program is tested, acquiring a main process address and a subprocess address of the target application program, wherein the main process address is a code block address of a main process for realizing the target application program, and the subprocess address is a code block address of a subprocess for realizing the target application program;
monitoring a window event in the target application program through the main process address, wherein the window event indicates that the target application program is processing a window object;
acquiring first attribute information of a window corresponding to the window object through the subprocess address, wherein the first attribute information indicates whether the window is a popup window;
and when the first attribute information indicates that the window is a popup window, executing predetermined processing on the window.
2. The method of claim 1, wherein obtaining the host process address and the sub-process address of the target application comprises:
acquiring a program instance object of the target application program, and acquiring the main process address corresponding to the program instance object by calling a preset interface;
and acquiring an element instance object of the target application program, and acquiring the sub-process address corresponding to the element instance object by calling the preset interface.
3. The method of claim 1, wherein listening for window events in the target application via the host process address comprises:
acquiring second attribute information of the object being processed by the target application program according to the main process address, wherein the second attribute information indicates whether the object being processed by the target application program is a window object;
and when the second attribute information indicates that the object being processed by the target application program is a window object, determining that the window event is monitored.
4. The method according to claim 1, wherein before performing the predetermined processing on the window, further comprising:
acquiring a visualization attribute of the window, wherein the visualization attribute indicates whether the corresponding window is visible or not;
performing the step of performing the predetermined processing on the window when the visualization property of the window indicates that the window is visible.
5. The method of claim 1, wherein said performing a predetermined treatment on said window comprises:
traversing each button contained in the window, and determining a window closing button in each button;
and simulating to click the window closing button.
6. The method according to any one of claims 1 to 5, wherein before the obtaining the main process address and the sub-process address of the target application, further comprising:
acquiring main process information of the target application program, wherein the main process information comprises version information of an operating system;
the acquiring the main process address and the sub process address of the target application program comprises the following steps:
and when the version information of the operating system indicates that the version of the operating system is not lower than a preset version, executing the step of acquiring the main process address and the sub-process address of the target application program.
7. The method according to any one of claims 1 to 5, wherein the target application is an application running based on an iOS system.
8. A pop-up window processing apparatus, comprising:
the system comprises an address acquisition module, a test module and a test module, wherein the address acquisition module is used for acquiring a main process address and a subprocess address of a target application program when the target application program is tested, the main process address is a code block address of a main process for realizing the target application program, and the subprocess address is a code block address of a subprocess for realizing the target application program;
the event monitoring module is used for monitoring a window event in the target application program through the main process address, wherein the window event indicates that the target application program is processing a window object;
a first attribute obtaining module, configured to obtain first attribute information of a window corresponding to the window object through the subprocess address, where the first attribute information indicates whether the window is a popup window;
and the processing module is used for executing preset processing on the window when the first attribute information indicates that the window is a popup window.
9. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the pop-window processing method of any of claims 1 to 7.
10. A computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the pop-window processing method of any one of claims 1 to 7.
CN201711077207.9A 2017-11-06 2017-11-06 Popup window processing method and device Active CN109753425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711077207.9A CN109753425B (en) 2017-11-06 2017-11-06 Popup window processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711077207.9A CN109753425B (en) 2017-11-06 2017-11-06 Popup window processing method and device

Publications (2)

Publication Number Publication Date
CN109753425A CN109753425A (en) 2019-05-14
CN109753425B true CN109753425B (en) 2021-04-02

Family

ID=66401087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711077207.9A Active CN109753425B (en) 2017-11-06 2017-11-06 Popup window processing method and device

Country Status (1)

Country Link
CN (1) CN109753425B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286781A (en) * 2019-07-23 2021-01-29 百度时代网络技术(北京)有限公司 Automatic testing method, device, equipment and storage medium
CN111818375A (en) * 2020-06-09 2020-10-23 深圳市天威视讯股份有限公司 Popup window detection method and device for intelligent set top box and intelligent set top box
CN111966562B (en) * 2020-07-21 2024-07-02 北京视博云信息技术有限公司 Cloud platform monitoring method and device and readable storage medium
CN112199284A (en) * 2020-10-10 2021-01-08 广州华多网络科技有限公司 Program automation testing method and corresponding device, equipment and medium
CN113282361B (en) * 2021-04-21 2022-09-23 荣耀终端有限公司 Window processing method and electronic equipment
CN113448668B (en) * 2021-06-22 2023-09-29 北京百度网讯科技有限公司 Method and device for skipping popup window and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123226A (en) * 2014-07-30 2014-10-29 深圳市共进电子股份有限公司 Processing method for popup form in automatic testing
CN105487758A (en) * 2015-12-11 2016-04-13 小米科技有限责任公司 Method and device for popup control of application software, and terminal equipment
CN105573911A (en) * 2015-12-10 2016-05-11 北京奇虎科技有限公司 Application popup window processing method and apparatus
CN106599246A (en) * 2016-12-20 2017-04-26 维沃移动通信有限公司 Display content interception method, mobile terminal and control server
CN106941568A (en) * 2017-03-30 2017-07-11 努比亚技术有限公司 A kind of Toast pop-ups optimization display methods, device and Toast pop-ups dispatching method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150065367A (en) * 2013-12-05 2015-06-15 엘지전자 주식회사 Mobile terminal and controlling method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123226A (en) * 2014-07-30 2014-10-29 深圳市共进电子股份有限公司 Processing method for popup form in automatic testing
CN105573911A (en) * 2015-12-10 2016-05-11 北京奇虎科技有限公司 Application popup window processing method and apparatus
CN105487758A (en) * 2015-12-11 2016-04-13 小米科技有限责任公司 Method and device for popup control of application software, and terminal equipment
CN106599246A (en) * 2016-12-20 2017-04-26 维沃移动通信有限公司 Display content interception method, mobile terminal and control server
CN106941568A (en) * 2017-03-30 2017-07-11 努比亚技术有限公司 A kind of Toast pop-ups optimization display methods, device and Toast pop-ups dispatching method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于instruments-Automation的iOS应用UI自动化测试图文攻略;close_marty;《CSDN,https://blog.csdn.net/close_marty/article/details/34527821》;20140625;全文 *
探究腾讯新闻弹窗品质如何提升——基于成都地区大学生网民调查;李馨雨;《新闻研究导刊》;20161231(第5期);第87页 *

Also Published As

Publication number Publication date
CN109753425A (en) 2019-05-14

Similar Documents

Publication Publication Date Title
CN109753425B (en) Popup window processing method and device
CN107908952B (en) Method and device for identifying real machine and simulator and terminal
US10551980B2 (en) Electronic device and method for determining touch coordinate thereof
CN106649126B (en) Method and device for testing application program
CN105630685A (en) Method and device for testing program interface
CN104516812A (en) Method and device for testing software
CN110196795B (en) Method and related device for detecting running state of mobile terminal application
CN106126015A (en) A kind of application program launching control method and terminal
CN108055092B (en) Bluetooth signal adjusting method, device, test terminal, system and readable medium
CN105740145B (en) The method and device of element in orient control
CN111078556B (en) Application testing method and device
CN106776301B (en) Subelement testing method and device
CN104281394A (en) Method and device for intelligently selecting words
CN112199246B (en) Terminal test method and device, storage medium and mobile terminal
CN109739758B (en) Test case conversion method and device
WO2015027864A1 (en) Method, device and touch screen apparatus for refreshing content of draggable listview
CN107896256B (en) Information pushing method and device, mobile terminal, server and readable storage medium
CN110069407B (en) Function test method and device for application program
CN112749074B (en) Test case recommending method and device
CN109196480B (en) Method for displaying equipment identification, mobile terminal and terminal equipment
CN115904950A (en) Test case generation method, device, equipment and storage medium
CN113868132A (en) Application program testing method and device, electronic equipment and storage medium
CN110958352B (en) Network signal display method, device, storage medium and mobile terminal
CN111090570A (en) Method and device for measuring response time of terminal screen and terminal equipment
CN109902484B (en) Processing method of associated application and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant