0

I need to automate some repetive tasks performed in an application installed in my machine. I'm coding in C# and using the library TestStack.White I can key in keyboard inputs like SHIFT or RETURN but I can´t figure out how to send a key combo. I must send SHIFT+RETURN but this keystroke is not available in TestStack.White as far as I know. How to do it? Maybe it is easier using Windows.Forms.SendKeys... Thank you in advance.

ts_ui_items.TextBox textBox = characteristics_window.Get(ts_ui_items.Finders.SearchCriteria.ByClassName("Edit"));

textBox.Text = "something";

ts.InputDevices.Keyboard.Instance.HoldKey(ts.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT); 

textBox.KeyIn(ts.WindowsAPI.KeyboardInput.SpecialKeys.RETURN); 

ts.InputDevices.Keyboard.Instance.LeaveKey(ts.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT);

textBox.Text = "nice";

This piece of code outputs a text in the application's window in its text box like:

something

nice

This is what I tried and it kind of worked but I think this is not the optimal solution....

3
  • 1
    You would have a better received question if you posted the code you have and have tried and what about the code isn't working/doesn't meet your needs. This is explained in our help center section! :) Commented Oct 8, 2019 at 16:11
  • 1
    You haven't tried anything out yet? Please provide some code that you have tried so we can assist you better. As @Symon said, visit the help center. It will allow you to learn how this forum works and what you need to do to have a good question! :) Commented Oct 8, 2019 at 16:18
  • Sorry I forgot to post what I have tried. See the edited post please. Commented Oct 8, 2019 at 16:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.