LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to simulate click button, enter string on the window/dialog of the other running application?

I have an application (running by Labview Source code or executable). There are many steps need click button, enter string on the UI or dialog to run this end to end.

 

I need do these steps manually by mouse click and enter on keyboard. But I need run these steps many time which is boring, time consuming and easy to make mistake.

 

I'd like to write a tool (Labview) to automate above steps by simulate button click and string enter. Is there any example or existing tools I can use ?

0 Kudos
Message 1 of 18
(3,379 Views)

If you have the source code as you seem to indicate, why not just modify the code to allow it to run without user interaction?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 18
(3,345 Views)

Because I need to run regression test on the executable to make sure the application response correctly to the user actions.

 

Also I need separate the application source code and the new test code I am going to write, because user only need the application executable which has human interaction (mouse click, keyboard enter).

0 Kudos
Message 3 of 18
(3,321 Views)

Depending on the structure of the code you should be able to test the core functionality of the application without user interation. If your application separates the business logic from the UI, you can fully test the functionality using automation and not require user interaction. Yes, you do need to test the UI as well but that is a different type of tool. There are third party tools for automating GUI but they tend to be very brittle. Many rely on screen coordinates to activate your UI components and require lots of maintenance as the application changes over time.

 

There is no pure LabVIEW way to accomplish what you want. Best approach is to structure your code such that core functionality can be tested/simulated without the the UI interaction. This will verify the majority of your application. Final UI testing would require a user but if everything under the hood is working, the UI testing should be to bad.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 18
(3,311 Views)

I just need an example vi or tool can do following automatically instead of mouse click and enter keyboard:

 

1. Detect the application window, click one of the buttons on it.

2. Fill out the blank try on the window. (I already have vi can read strings from file).

 

 

In the test, I have to repeat hundreds of times of above 2 step with click different button, enter string. Now I do it manually which is boring and time consuming. I have some vi to read string from file, decide which button to click.

 

Just need to integrate with other Labview code which can perform button click and string enter on the dialog.

0 Kudos
Message 5 of 18
(3,306 Views)

I am looking for a tool/code like "Auto Clicker" to repeat hundreds of click automatically.

But if there is Labview code can do similar job, I can integrate that code into my Labview which will be great.

0 Kudos
Message 6 of 18
(3,285 Views)

No, LabVIEW does not have that capability. It is a programming language. I suggested ways you can structure your application to make automated testing easier. It won't eliminate th eneed to verify the UI but a large portion of your application could be tested using various frameworks within LabVIEW such as the Unit Test framework.

 

If you need a something to simulate user interactions you will need to find other tools.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 18
(3,280 Views)

In Labview, is there an example how to get the handle/ref of a running window/dialog ?

And get the ref of the 3 buttons on that dialog, then simulate click one of the 3 buttons ?

0 Kudos
Message 8 of 18
(3,275 Views)

there are examples of simulating keyboard presses and mouse interactions.https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756?...

 

Now I only need example Labview code to get the handle/ref of the running app/window/dialog (Labview executable), so I can simulate key press on that app/window/dialog

 

 

0 Kudos
Message 9 of 18
(3,232 Views)

If you made the exe, it can be quite simple.

 

Make a VI that uses VI server to get a reference to he VI, use value change events to type text\press buttons.

 

This can be a piece of cake, or it can be very, very hard. Pressing a button is trivial, unless the button is set to latch. Then it's not possible to use a value signaling. You'll have to get it

s position and use the OS to simulate a click. Getting the position can be very, very hard. For instance the button can be in a clone, the clone can be in a subpanel, the subpanel can be in a clone, in a subpanel.

 

Anyway, if you drop the VI on the running executable, it will be loaded, and it can be run (automatically). This way, you can add functionality to your executable.

 

If you design the Vi to accept data from a named pipe or TCP\IP connection, you can tell it wat to do from outside the executable.

0 Kudos
Message 10 of 18
(3,205 Views)