You must Sign In to post a response.
  • Category: WPF

    How do I click WPF control from outside program

    Hai There,

    We have one WPF application to test the Instruments that developed by R&D Team. User have to install that software and connect the instrument in to PC. Each type of instruments has its own set of test and test order. Test & test order already configured in the application itself. like Test 1 and Test 2 and so on.

    User have to click the 'Start Test' button to start test. Application start execute the 'Test 1', If 'Test 1' is passed user manually select 'Test 2' to execute. If 'Test 1' failed user have do some other test. As of now all are manual process.

    Now we are planning to do automatic test, mean we have to write new application to watch the Parent (WPF) application after user click 'Start Test' button, parent application start the 'Test 1'. If 'Test 1' passed application automatically select 'Test 2' to execute.

    In other wards, instead of clicking the Parent WPF application to the step. we have to develop the application to do action on parent WPF application's controls, like if control is Button click the Button automatically, If alert ask to click Yes or No, click Yes automatically.

    Important think to note, we should not edit/modify R&D developed software. That is the reason have to separate application to control Parent WPF application

    Any idea please share.
  • #763992
    Hai Gokula,
    I think first of all you need to activate the WPF application and then you can write the routed event and then attach the event handler which will activate the button click event and then in the button click event, you can write whatever you want.
    You can refer the below links to do:

    http://stackoverflow.com/questions/17878730/how-to-automatically-click-a-button-on-a-form-application
    http://stackoverflow.com/questions/2378537/how-to-programmatically-start-a-wpf-application-from-a-unit-test

    To activate/Run the WPF application:

    TestProject.App application = new TestProject.App();
    application.InitializeComponent();
    application.Run();

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments