简体   繁体   English

Telerik Test Studio-如何发送简单的ESC键?

[英]Telerik Test Studio - How to send a simple ESC key?

I've tried a few things that I found online but I'm not able to just send a simple KeyPress of the "ESC" key into my tests. 我已经尝试了一些在网上找到的东西,但无法将“ ESC”键的简单KeyPress发送到测试中。

I just want to send the "ESC" key on my C# test code and using Telerik Test studio to run the test. 我只想在我的C#测试代码上发送“ ESC”键,并使用Telerik Test Studio运行测试。

What do I need? 我需要什么? Isn't this enough?? 这还不够吗?

SendKeys.Send("{ESC}");

STEP 1 : Add an Assembly Reference to System.Windows.Forms (in case it's not already added) 步骤1:向System.Windows.Forms添加一个程序集引用(如果尚未添加)

STEP 2 : In place of - SendKeys.Send("{ESC}"); 步骤2:代替SendKeys.Send("{ESC}");

Use this code below: 在下面使用此代码:

Manager.Desktop.KeyBoard.SendString("{ESC}");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM