Closed valeriigamaley closed 1 year ago
You should try to find the ui element correctly. Windows controls will show different properties and behaviors depending on the different ui framework used. Sometimes delays in loading the interface can also affect lookup. The inspect tool may help you to find properties for filtering element. And you also have to wait a while while you search.
You need to choose the appropriate way to trigger the control's action.
There are some encapsulated controls in uiautomation::controls*
, such as ButtonControl
, WindowControl
, and so on.
Each control supports one or more actions(defined in uiautomation::actions::*
).
You can triggle actions with some appropriate control. For example:
let button: ButtonControl = element.try_into()?;
button.invoke()?;
Occasionally a control's action does not respond correctly. You may need to simulate mouse or keyboard operations to complete the operation.
UIElement::click()
and UIElement::send_keys()
are simple ways to simulate mouse and keyboard events.
You can do more by using uiautomation::inputs::Mouse
and uiautomation::inputs::Keyboard
.
This sample may be useful for you: win-update
Good luck!
@leexgone Thanks for advice, now i get a result through imitate mouse action like a UIElement::click()
:)
Introduction:
Hello, guys) you did such a nice work and now i wanna try using your crate at my job. Now I have some dummy but important question: how I can make a click on element which is detected by that crate? I wanna install .NET SDK but i won`t click to button Next manually (such as an cursor position) and need to click on button by for it instance. How you will seen, if you try to run code example, Next button will be detect correctly and log inform about that.
Steps to reproduce:
Code Example:
Software: Win10 x64, rustc 1.69, cargo 1.69, uiautomation 0.51