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....

Community
  • 1
  • 1
  • 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] section! :) – Jaskier Oct 08 '19 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! :) – rad_ Oct 08 '19 at 16:18
  • Sorry I forgot to post what I have tried. See the edited post please. – André Serrano Oct 08 '19 at 16:26

0 Answers0