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

Clear text in html input text and text area controls

1 Answer 134 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jamie
Top achievements
Rank 2
Jamie asked on 06 Sep 2011, 09:52 PM
What is the easiest way to clear the text out of a HtmlInputText or HtmlTextArea control within csharp code?

Currently we are using the following coding logic, but I would prefer something cleaner.

 

 

Desktop desktop = new Desktop();

 

 

 

 

desktop.KeyBoard.KeyPress(Keys.Back, 1, repeatCount);

 

desktop.KeyBoard.TypeText(text, 2, 0);

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 07 Sep 2011, 10:57 PM
Hi Jamie,

I successfully accomplished this by first finding the HtmlInputText, and then setting its text to be blank:

HtmlInputText input2 = Find.ByExpression<HtmlInputText>("name=FirstName");
input2.Text = "";


Kind regards,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Tags
General Discussions
Asked by
Jamie
Top achievements
Rank 2
Answers by
Anthony
Telerik team
Share this question
or