Qt Object API
Object manipulation API methods are divided into two categories, operations and properties. The operation does the actual action on the control, and the property is to obtain the run-time properties of the control. Because the control access is asynchronous, the properties are also obtained in the form of methods, that is, you need to add parentheses "()" when calling, and the Promise object that returns the target value-Promise<T>
, needs to be added before the call await
keyword to get the result in Promise.
API syntax description
Qt's API documentation is based on the type file of leanpro.qt
(for example, you can enter the type definition file of leanpro.qt.d.ts
to view the calling method of the API), so it uses the TypeScript
syntax. A brief introduction is made based on the knowledge required to read the document. If you want to learn more, you can go to TypeScript Chinese Introduction to learn more about related syntax.
The first is the name of the current class, here is IQtControl
, the full name can be understood as Interface of Qt Control
, representing the generalized Qt control interface definition.
The second is the base class, which represents the base class from which the current class extends, and the extension represents the inheritance of the properties and methods in the base class. This is extended from the container class IQtContainer
. The container contains various object acquisition APIs. Such an extension can achieve chained object acquisition.
For example, to get the complete call of the "Family" cell in the "sheet1" table in the "Table OverView" window can be written as:
JavaScriptPythonmodel.getWindow("Table Overview").getTable("sheet1").getTableItem("Family");
model.getWindow("Table Overview").getTable("sheet1").getTableItem("Family")
CukeTest will optimize when actually generating the control call code, so we don't usually see such a long call.
The last is the operation method and property method of the current class. There is a blank line between the operation method and the property method to indicate the distinction. ()
represents the number of parameters passed in, the format of the parameter is [argName]:[argType]
, if there is a ?
before :
, it means that the parameter has a default value, even if it is empty Does not affect operation. The tail of the method (after the last :
) represents the return value of the method, Promise<T>
indicates that the method is an asynchronous method, and only T
represents a synchronous method.
The
T
here represents the type name, such asvoid
,string
,number
, etc.
The relationship of each class
In CukeTest, the expansion relationship between several classes is roughly as follows:
- The lowest base class, the container class
IQtContainer
, contains methods for obtaining automation objects; - The second base class, the basic control class
IQtControl
, contains the common operation and property methods of each control; - Specific control classes, such as
IQWindow
,IQLabel
... etc. A series of specific Qt controls, in addition to the extended methods, most controls contain their own unique operations and property methods to achieve different Automation of controls.
Common API
Different types of object operations have different operations and properties. They all have some common operations and properties, which can be called no matter which control they are, as follows:
export interface IQtControl extends IQtContainer {
// General method of operation
click(x?: number, y?: number, mousekey?: number): Promise<void>;
dblClick(x?: number, y?: number, mousekey?: number): Promise<void>;
moveMouse(x?: number, y?: number, seconds?: number): Promise<void>;
wheel(value: number): Promise<void>;
drop(x?: number, y?: number, seconds?: number): Promise<void>;
drag(x?: number, y?: number): Promise<void>;
pressKeys(keys: string, options?: PressKeysOptions | number): Promise<void>;
highlight(duration: number);
takeScreenshot(filePath?: string): Promise<void | string>
// Generic property method
rect(): Promise<Rect>;
winId(): Promise<number>;
enabled(): Promise<boolean>;
visible(): Promise<boolean>;
modelProperties(): {[x: string]: any};
modelImage(options?: {encoding: 'buffer' | 'base64'}): Promise<Buffer | string>; //base64 is the default
allProperties(): Promise<object>
property(propertyName: string): Promise<any>
waitProperty(propertyName: QtPropertyIds, value: string | number | boolean, timeOutSeconds: number): Promise<boolean>
// general navigation method
firstChild(controlType?: QtControlType): Promise<IQtControl>;
lastChild(controlType?: QtControlType): Promise<IQtControl>;
next(controlType?: QtControlType): Promise<IQtControl>;
previous(controlType?: QtControlType): Promise<IQtControl>;
parent(): Promise<IQtControl>;
// Common Control Search Methods
findControls(...conditions: ConditionFilter[]): Promise<IQtControl[]>;
}
class QtControl(QtContainer):
def click(x: Optional[int]=None, y: Optional[int]=None, mousekey: Optional[int]=None) -> None
def dblClick(x: Optional[int]=None, y: Optional[int]=None, mousekey: Optional[int]=None) -> None
def exists(seconds: Optional[int]=None) -> bool
def moveMouse(x: Optional[int]=None, y: Optional[int]=None, seconds: Optional[int]=None) -> None
def wheel(value: int) -> None
def drop(x: Optional[int]=None, y: Optional[int]=None, seconds: Optional[int]=None) -> None
def drag(x: Optional[int]=None, y: Optional[int]=None) -> None
def pressKeys(keys: str, opt: Optional[Union[int, PressKeysOptions]]=None) -> None
def highlight(duration: Optional[int]=None) -> None
def takeScreenshot(filePath: Optional[str]=None) -> Union[str, None]
def rect() -> "Rect"
def winId() -> int
def enabled() -> bool
def visible() -> bool
def modelProperties(all: Optional[bool]=None) -> TypedDict
def modelImage(encoding: Optional[str]=None) -> Union[str, bytearray]
def allProperties() -> TypedDict
def property(propertyIds: str) -> Union[str, int, bool, TypedDict]
def waitProperty(propertyName: str, value: Union[str, int, bool], timeOutSeconds: Optional[int]=None) -> bool
def firstChild(controlType: Optional[str]=None) -> "QtControl"
def lastChild(controlType: Optional[str]=None) -> "QtControl"
def next(controlType: Optional[str]=None) -> "QtControl"
def previous(controlType: Optional[str]=None) -> "QtControl"
def parent() -> "QtControl"
def findControls(*conditions: List[Union[str, Dict]]) -> List[QtControl]
Methods
click(x, y, mousekey): Promise<void>
Send a click signal, the default is to left click the center of the target control.
- x:
number
type, the horizontal pixel of the relative coordinate, the default is the horizontal center; - y:
number
type, the vertical pixel of the relative coordinate, the default is the vertical center; - mouseKey: Left and right mouse buttons, 1 is the left button, 2 is the right button; the default value is 1;
- Return value: Asynchronous method that does not return any value.
dblClick(x, y, mousekey): Promise<void>
Send a double-click signal, the default is to double-click the center of the target control.
- x:
number
type, the horizontal pixel of the relative coordinate; the default is the horizontal center; - y:
number
type, the vertical pixel relative to the coordinate; the default is the vertical center; - mouseKey:
number
type, left and right mouse buttons, 1 is the left button, 2 is the right button; the default value is 1; - Return value: Asynchronous method that does not return any value.
wheel(value): Promise<void>
Send the mouse wheel signal.
- value:
number
type, positive value scrolls forward, negative value scrolls backward. For example, 1 scroll forward one space, -1 scroll backward one space - Return value: Asynchronous method that does not return any value.
moveMouse(x, y): Promise<void>
Move the mouse position to the specified position, x
and y
are the horizontal and vertical pixels relative to the position of the control.
- x:
number
type, the horizontal pixel of the relative coordinate; - y:
number
type, the vertical pixel relative to the coordinate; - Return value: Asynchronous method that does not return any value.
drag(x, y): Promise<void>
The first step of the drag operation is to press and hold the mouse at the target position without releasing it, and x
and y
are the horizontal and vertical pixels relative to the position of the control.
- x:
number
type, Relative coordinates of horizontal pixels; - y:
number
type, vertical pixels relative to coordinates; - Return value: Asynchronous method that does not return any value.
drop(x, y, seconds): Promise<void>
The second step of the drag operation is to move the mouse position to the specified position and release the mouse. x
and y
are the horizontal and vertical pixels relative to the position of the control. The third parameter is used to control the speed of the mouse movement, the larger the slower, the smaller the faster.
- x:
number
type, Relative coordinates of horizontal pixels; - y:
number
type, vertical pixels relative to coordinates; - seconds:
number
type, The duration of mouse movement, the default is 1, that is, 1 second; - Return value: Asynchronous method that does not return any value.
pressKeys(keys, options?): Promise<void>
Enter a key or character string, and focus on the target control before inputting. When a string is passed in, some special characters (^+~%{}()
) in the string will be executed as control keys (Shift
key, CTRL
key, etc.) For the corresponding symbols, please refer to Appendix: Input Key Correspondence Table for details. If you want to enter plain text, ignoring these control key symbols, you can use the {textOnly: true}
option and call it like this: pressKeys(str, {textOnly: true})
.
- keys:
string
type, The key, key combination or character string to be input, up to 1024 characters are supported. - options: (Optional) Some optional parameters that control the input mode.
- textOnly: Enter only character strings, and also enter control characters as text. The effect is equivalent to calling
Keyboard.typeString()
. - cpm: That is, the number of characters entered per minute, which is used to control the text input speed. It is recommended to set the
cpm
value above 200 for automatic operation. Due to the internal implementation of the method and the different processing of text input by various systems and applications, the actual input speed may not reach the setcpm
. When options is a number, it is equivalent to the cpm parameter.
- textOnly: Enter only character strings, and also enter control characters as text. The effect is equivalent to calling
- Return value: Asynchronous method that does not return any value. For more instructions or examples, please refer to Simulating Keyboard Operations。
highlight(duration: number): Promise<void>
The control is highlighted, and parameters can be passed in to specify the duration of the highlight in milliseconds. The default value is 1000, which lasts for 1 second.
- duration: (Optional)
number
type, highlight duration, in milliseconds. - Return value: Asynchronous method that does not return any value.
takeScreenshot(filePath?: string): Promise<void | string>
The screenshot of the control, you can pass in the path to save the screenshot to the path location.
- filePath: (Optional)
string
type, the save path and file name of the screenshot, such as"./images/screenshot1.png"
. - Return value: Asynchronously return the
base64
string of the screenshot.
Property Methods
rect(): Promise<Rect>
Obtain the shape and position information of the target control.
- Return value: Return a
Rect
object, which contains the coordinate informationx
andy
of the control, and the width and height informationwidth
andheight
.
winId(): Promise<number>
Get the window handle ID of the target control.
- Return value: Asynchronously return a string of numbers representing the window handle ID.
enabled(): Promise<boolean>
Get the availability of the target control. When the control is not available, it will not respond to clicks or input operations.
- Return value: asynchronously returns the boolean value of whether the target control is available.
visible(): Promise<boolean>
Get the visibility of the target control. When the control is invisible, it will not be displayed on the desktop and cannot be operated.
- Return value: asynchronously returns the Boolean value of whether the target control is visible.
modelProperties(): Promise<object>
Get the model properties of the target control, that is, the properties of the corresponding model object (recognition properties and other properties).
- Return value: Asynchronously return the object
object
composed of the properties of the target model object.
modelImage(options?: {encoding: 'buffer' | 'base64'}): Promise<Buffer | string>
Get the screenshot file content of the target control in the model.
- options:
- encoding:
buffer
orbase64
two options, the format of the return value.
- encoding:
- Return value: Asynchronously returns the screenshot file stream (base64 encoding or
Buffer
) of the target control in the model.
allProperties(): Promise<object>
Gets all runtime properties of the target control, returned as an object.
- Return value: Asynchronously return the object
object
composed of the properties of the target model object. For example:
let properties = await model.getButton("Button").allProperties();
console.log(properties);
console.log('objectName=' + properties['objectName']); //Get only one of the properties, such as objectName
properties = await model.getButton("Button").allProperties()
print(properties)
print('objectName=' + properties['objectName']); #Get only one of the attributes, such as objectName
Will get all the properties of the button and print:
{
"acceptDrops": false,
"accessibleDescription": "",
"accessibleName": "",
"arrowType": 0,
"autoExclusive": false,
...
"objectName": "button1",
"x": 11,
"y": 11
}
Line 3 of the above code will print a certain property:
objectName=button1
property(name): Promise<any>
Get the specified runtime property of the target control, and return the data type corresponding to the property.
- Return value: Asynchronously return various property values. For example, the above script that only gets one property:
let properties = await model.getButton("Button").allProperties();
console.log(properties['objectName']); //Get only one of the properties, such as objectName
properties = model.getButton("Button").allProperties()
print(properties['objectName']); #Get only one of the attributes, such as objectName
You can directly call property()
to get:
let objectName = await model.getButton("Button").property('objectName');
objectName = model.getButton("Button").property('objectName')
waitProperty(propertyName: QtPropertyIds, value: string | number | boolean, timeOutSeconds: number): Promise<boolean>
Waits for a property to have a value.
- propertyName: Property name, the supported property names are enabled, text, value.
- value: property value.
- timeOut: Waiting timeout seconds setting, the default is 5 seconds, -1 will wait infinitely.
- Return value: Indicates whether it is successful or not until the value appears. If an error is reported, it means that the control is not matched. It may be that the control does not appear, or there is a problem with the object name.
The following sample code waits for the button to change from disabled to clickable, then clicks it:
await model.getButton("下一步").waitProperty("enabled", true);
await model.getButton("下一步").click();
model.getButton("下一步").waitProperty("enabled", true)
model.getButton("下一步").click()
Navigate Methods
CukeTest provides a series of control navigation methods, so that users can use navigation methods to retrieve the parent control, child control and sibling controls of the target control. Through the navigation method, an anchor control can be used to index all controls in the entire control tree, which is often used in scenarios such as input box positioning and control traversal.
The navigation methods are all asynchronous methods, that is, it takes a certain amount of time to retrieve the navigated control in the application and return it, instead of directly navigating in the tree of the model manager, which needs to be distinguished and not confused.
firstChild(controlType?: QtControlType): Promise<IQtControl>
Get the first sub-control of the control in the application, you can specify the sub-control type by passing in the parameter controlType
, and you can achieve the filtering effect, that is, get the first sub-control of controlType
type in the application , controlType
is a string, and the optional value can refer to QtControlType. Returns null
if there are no child controls that satisfy the condition.
At the same time, child
only represents direct child controls, and will not retrieve grandchild controls. If no controls satisfying the conditions are found in child controls, it will directly return null
instead of continuing to search in grandchild controls. If you still want to get all the controls under a certain control, you can use the findControls method.
- controlType: (Optional) String type, optional value can refer toQtControlType。
- Return value: Asynchronous arbitrary control type, the specific type depends on the type of control navigated to. Returns
null
when no controls have been navigated to.
Note that if some controls are invisible or not yet loaded, they will not be counted. To be precise, the
firstChild()
method just gets the first child object that can be obtained. The same goes for thelastChild()
method below.
lastChild(controlType?: QtControlType): Promise<IQtControl>
To get the last sub-control of the control in the application, you can specify the sub-control type by passing in the parameter controlType
, which can achieve the effect of filtering, that is, to get the last sub-control of controlType
type in the application,controlType
is a string, and the optional value can refer to QtControlType. Returns null
if there are no child controls that satisfy the condition.
- controlType: (Optional) String type, optional value can refer toQtControlType。
- Return value: Asynchronous arbitrary control type, the specific type depends on the type of control navigated to. Returns
null
when no controls have been navigated to.
next(controlType?: QtControlType): Promise<IQtControl>
Gets the control's next sibling control in the application, usually the adjacent right/bottom node, depending on the layout direction of the container. You can specify the sibling control type by passing in the parameter controlType
, which can achieve the filtering effect, that is, get the next sibling control of the controlType
type in the application, controlType
is a string, and the optional value can refer to QtControlType. Return null
if there is no sibling control that meets the conditions, for example, null
will be returned when the control is the lastChild
of the parent control.
- controlType: (Optional) String type, optional value can refer toQtControlType。
- Return value: Asynchronous arbitrary control type, the specific type depends on the type of control navigated to. Returns
null
when no controls have been navigated to.
previous(controlType?: QtControlType): Promise<IQtControl>
Contrary to the next()
method, gets the control's previous sibling control in the application, usually the adjacent left/top node, depending on the layout direction of the container. You can specify the sibling control type by passing in the parameter controlType
, which can achieve the filtering effect, that is, get the next sibling control of the controlType
type in the application, controlType
is a string, and the optional value can refer to QtControlType. Return null
if there is no sibling control that satisfies the condition, for example, null
will be returned when the control is the firstChild
of the parent control.
- controlType: (Optional) String type, optional values can refer to QtControlType。
- Return value: Asynchronous arbitrary control type, the specific type depends on the type of control navigated to. Returns
null
when no controls have been navigated to.
parent(): Promise<IQtControl>
Contrary to firstChild()
and lastChild()
methods, get the parent control of the control, and return null
if the control is the topmost control.
- Return value: Asynchronous arbitrary control type, the specific type depends on the type of control navigated to. Returns
null
when no controls have been navigated to.
findControls(...conditions: ConditionFilter[]): Promise<IQtControl[]>
The search method allows the user to more finely and autonomously use the user-given search criteria to match controls in the application under test. It can be understood as a navigation method similar to children
, which will match all child controls in the target control and filter according to the filter conditions. Therefore, you can directly pass a filter criteria object Criteria
; in addition, you can also choose to pass in a model object name objectName
, which will automatically use the identification properties of the model object as the filter criteria.
It returns all control objects satisfying the condition as an array. It can obtain all matching controls on the application in real time according to the incoming conditions, and return the Promise
of the object array. This API can be used when there are multiple similar controls on the interface, and return this group of objects at the same time, so as to operate on all these corresponding controls.
Use the findControls()
method to accomplish some special-case tasks:
Scenario 1: Batch operation
With the help of the findControls()
method, the properties of multiple control objects can be returned, and a large number of similar controls in the application can be traversed. For example, to select all the check boxes in the container control named "Dock", you can use the following script to complete:
let checkboxes = await model.getGeneric("Dock").findControls({type:"CheckBox"});
// At this point the checkboxes variable is an array full of checkbox objects
for(let index in checkboxes){
await checkboxes[index].check();
}
checkboxes = model.getGeneric("Dock").findControls({type:"CheckBox"})
# At this point the checkboxes variable is an array full of checkbox objects
for index in checkboxes:
checkboxes[index].check()
Other Classes
Rect type
An object used to describe the shape and position of the control. In CukeTest, all controls can use a rectangle (Bounding Rectangle) to describe position and shape information. The Rect
object contains the following properties:
- x:
number
type, the horizontal pixel of the relative coordinate; - y:
number
type, the vertical pixel relative to the coordinate; - width:
number
type, horizontal width, in pixels; - height:
number
type, vertical height, in pixels;
This article only introduces the basic concepts of object operations and the methods of the two base classes. For more documentation about API introduction, you can continue to read the next article: API of Basic Type Objects.
In addition, the specific definitions of each operation and attribute can be found in the model manager, or you can open the type file of the Qt automation API library that comes with CukeTest-the type file of leanpro.qt
to search, the specific method can be See the introduction in the More API Introduction section.
QtControlType
Contains all Qt control types, and is usually used in findControls() method or navigation method to obtain the specified type of control object.
enum QtControlType {
Button = 'Button',
Calendar = 'Calendar',
CheckBox = 'CheckBox',
ComboBox = 'ComboBox',
Dial = 'Dial',
ItemView = 'ItemView',
ViewItem = 'ViewItem',
Label = 'Label',
List = 'List',
ListItem = 'ListItem',
GraphicsView = 'GraphicsView',
GroupBox = 'GroupBox',
Window = 'Window',
Menu = 'Menu',
MenuItem = 'MenuItem',
MenuBar = 'MenuBar',
MenuBarItem = 'MenuBarItem',
Edit = 'Edit',
Pane = 'Pane',
ProgressBar = 'ProgressBar',
RadioButton = 'RadioButton',
ScrollArea = 'ScrollArea',
Slider = 'Slider',
SpinBox = 'SpinBox',
StatusBar = 'StatusBar',
Tab = 'Tab',
TabBar = 'TabBar',
TabItem = 'TabItem',
Table = 'Table',
TableItem = 'TableItem',
ToolBar = 'ToolBar',
ToolBox = 'ToolBox',
Tree = 'Tree',
TreeItem = 'TreeItem',
Custom = 'Custom',
Application = 'Application',
}
Criteria
export interface Criteria {
appName?: string,
type?: QtControlType | string,
className?: string,
name?: string,
index?: number,
itemPath?: ItemPath,
itemIndex?: number,
text?: string,
toolTip?: string,
'text~'?: string,
'name~'?: string,
'toolTip~'?: string
}
class Criteria():
appName: str
type: str
className: str
name: str
index: int
itemPath: TypedDict
itemIndex: int
text: str
toolTip: str
Control Path
An object used to describe the position of the list item control ListItem
, the tree view item control TreeItem
and the table cell control TableItem
.
export type ItemPath = (number | [number, number])[];
API call skills
Distinguishing skills between synchronous and asynchronous methods
The API for obtaining objects is defined in the IQContainer
interface class, as follows:
export interface IQtContainer {
parent: IQtContainer;
getGeneric(...conditions: ConditionFilter[]): IQtControl;
getWindow(...conditions: ConditionFilter[]): IQWindow;
getButton(...conditions: ConditionFilter[]): IQButton;
......
getTable(...conditions: ConditionFilter[]): IQTable;
getTableItem(...conditions: ConditionFilter[]): IQTableItem;
getTree(...conditions: ConditionFilter[]): IQTree;
getTreeItem(...conditions: ConditionFilter[]): IQTreeItem;
getVirtual(...conditions: ConditionFilter[]): IVirtual;
}
class QtContainer():
def getApplication(*conditions: List[Union[str, Dict]]) -> "QApplication"
def getGeneric(*conditions: List[Union[str, Dict]]) -> "QtControl"
def getWindow(*conditions: List[Union[str, Dict]]) -> "QWindow"
def getButton(*conditions: List[Union[str, Dict]]) -> "QButton"
def getCalendar(*conditions: List[Union[str, Dict]]) -> "QtControl"
def getCheckBox(*conditions: List[Union[str, Dict]]) -> "QCheckBox"
def getComboBox(*conditions: List[Union[str, Dict]]) -> "QComboBox"
def getEdit(*conditions: List[Union[str, Dict]]) -> "QEdit"
def getGraphicsItem(*conditions: List[Union[str, Dict]]) -> "QGraphicsItem"
def getItemView(*conditions: List[Union[str, Dict]]) -> "QItemView"
def getViewItem(*conditions: List[Union[str, Dict]]) -> "QItemViewItem"
def getList(*conditions: List[Union[str, Dict]]) -> "QList"
def getListItem(*conditions: List[Union[str, Dict]]) -> "QListItem"
def getMenu(*conditions: List[Union[str, Dict]]) -> "QMenu"
def getMenuBar(*conditions: List[Union[str, Dict]]) -> "QMenuBar"
def getMenuBarItem(*conditions: List[Union[str, Dict]]) -> "QMenuBarItem"
def getMenuItem(*conditions: List[Union[str, Dict]]) -> "QMenuItem"
def getRadioButton(*conditions: List[Union[str, Dict]]) -> "QRadioButton"
def getSpinBox(*conditions: List[Union[str, Dict]]) -> "QSpinBox"
def getTab(*conditions: List[Union[str, Dict]]) -> "QTab"
def getTabBar(*conditions: List[Union[str, Dict]]) -> "QTabBar"
def getTabItem(*conditions: List[Union[str, Dict]]) -> "QTabItem"
def getTable(*conditions: List[Union[str, Dict]]) -> "QTable"
def getTableItem(*conditions: List[Union[str, Dict]]) -> "QTableItem"
def getTree(*conditions: List[Union[str, Dict]]) -> "QTree"
def getTreeItem(*conditions: List[Union[str, Dict]]) -> "QTreeItem"
def getVirtual(*conditions: List[Union[str, Dict]]) -> "Virtual"
def getPattern(*conditions: List[Union[str, Dict]]) -> "Pattern"
Promise<T>
, which means that these are all synchronous methods, that is, no You need to add the await
keyword to get the returned result. There is also a special synchronization method in the object manipulation API, which is the getItem
method belonging to the Table
, List
, and Tree
controls. It is also the only synchronization method in the object manipulation API.
You may be aware of this. Yes, there is a difference in naming between synchronous methods and asynchronous methods in CukeTest. The methods with the prefix of get-
are synchronous methods, without the keyword of await
; and those without this prefix It is an asynchronous method. If await
is not added, only a Promise object will be returned, and await
is the correct return value.
Use fuzzy matching (regular matching) to get controls
Observing the Criteria object
used to get the object, you can find that there are several special attributes in it, they are suffixed with ~
, and there are attributes with the same name in the Criteria object
.
These attributes with a ~
suffix indicate that these attributes allow fuzzy matching, or are also called regular matching. Fuzzy matching for controls can be manually enabled in the Model Manager. You can also use the following methods to match in the script:
// full text match
await model.getButton({"name": "数字5"}).click();
// Match all controls whose name attribute contains "数字"
await model.getButton({"name~": "数字"}).click();
// Match all controls whose name attribute ends with "5"
await model.getButton({"name~": "数字$"}).click();
# full text match
model.getButton({"name": "数字5"}).click()
# Match all controls whose name attribute contains "数字"
model.getButton({"name~": "数字"}).click()
# Match all controls whose name attribute ends with "5"
model.getButton({"name~": "数字$"}).click()
These attributes can be directly generated in the model manager through the "[Copy Node Attribute]" function, and do not necessarily need to be manually constructed.
More API introduction
More control operations and property help can be found in the model manager, or in the script generated by dragging and dropping the model file, hold down the Ctrl
key and click the leanpro.qt
reference in the script head to jump to the type Definition file.
Chinese version click here.