This is a migrated thread and some comments may be shown as answers.

How to send '@' as a key press to a text field

3 Answers 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tharinda
Top achievements
Rank 1
Tharinda asked on 09 Mar 2017, 07:59 AM

How can we send the '@' sign as in email address, as a keypress event ? here is my code:

 if (string.IsNullOrEmpty(searchText)) return;

           foreach (var key in searchText)

            {
                if (key.ToString() == ".")
                {
                    m.Desktop.KeyBoard.KeyPress(Keys.OemPeriod); 
                }

                if (key.ToString() == "@")
                {
                    m.Desktop.KeyBoard.KeyPress(???);
                }

 

3 Answers, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 13 Mar 2017, 01:57 PM
Hi Tharinda,

Please have a look how you could send keystrokes using the Telerik Testing Framework

Let me know if further details will be required. Thanks! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Tharinda
Top achievements
Rank 1
answered on 13 Mar 2017, 03:52 PM

Hi Elena,

Yes this worked for me. Thanks for the reply

if (key.ToString() == "@")
{
m.Desktop.KeyBoard.KeyDown(Keys.LShiftKey);
m.Desktop.KeyBoard.KeyPress(Keys.D2);
m.Desktop.KeyBoard.KeyUp((Keys.LShiftKey));

}

 

regs,

tharinda

0
Elena
Telerik team
answered on 14 Mar 2017, 02:39 PM
Hello Tharinda,

Thanks for getting back! I am glad to hear that worked for you as well. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Tharinda
Top achievements
Rank 1
Answers by
Elena
Telerik team
Tharinda
Top achievements
Rank 1
Share this question
or