A method and device for acquiring a control
A technology for obtaining controls and controls, applied in the computer field, can solve the problems of reduced automation coverage, inability to automate functions or scenes, and inability to obtain encapsulated control sub-controls, and achieve the effect of improving automation coverage.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0027] refer to figure 2 , figure 2 It is a flowchart of a method embodiment for obtaining a control provided in Embodiment 1 of the present invention; this embodiment is applied in an Android automated test, and the method for obtaining a control includes:
[0028] S101: According to the Java reflection mechanism, dynamically obtain the first basic control and the first encapsulated control of the current interface.
[0029] S102: Recursively traverse the second basic control in the first packaged control, and use the first basic control and the second basic control as a third basic control.
[0030] S103: Obtain visible controls of the current interface according to the third basic control.
[0031] S104: Find and acquire a basic control conforming to predetermined attribute information from the visible controls of the current interface.
[0032] In the Android automation test in this embodiment, all the basic controls of the current interface are obtained by recursivel...
Embodiment 2
[0034] refer to image 3 , image 3 It is a flow chart of a method embodiment for obtaining a control provided in Embodiment 2 of the present invention; this embodiment is applied in an Android automated test, and the method for obtaining a control includes:
[0035] S201: According to the Java reflection mechanism, dynamically acquire the first basic control and the first encapsulated control of the current interface.
[0036] The method of dynamically obtaining information and dynamically calling objects is called the java reflection mechanism; the Java reflection mechanism mainly provides the following functions: judging the class to which any object belongs at runtime; constructing an object of any class at runtime; judging any class at runtime The member variables and methods of the class; call the method of any object at runtime; generate dynamic proxy.
[0037] In the Android system, when the application program is running, the application program's response to the us...
Embodiment 3
[0071] refer to Figure 5 , Figure 5 It is a schematic structural diagram of an embodiment of an apparatus for acquiring controls provided in Embodiment 3 of the present invention; the apparatus for acquiring controls includes:
[0072] The dynamic acquisition module 301 is configured to dynamically acquire the first basic control and the first packaged control of the current interface according to the Java reflection mechanism.
[0073] The third basic control obtaining module 302 is configured to recursively traverse the second basic control in the first packaged control, and use the first basic control and the second basic control as a third basic control.
[0074] The visible control acquiring module 303 is configured to acquire the visible controls of the current interface according to the third basic control.
[0075] Obtaining module 304: configured to search for and obtain basic controls conforming to predetermined attribute information among the visible controls of...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


