Clear text in html input text and text area controls

2 posts, 0 answers
  1. Jamie
    Jamie avatar
    43 posts
    Member since:
    Jul 2011

    Posted 06 Sep 2011 Link to this post

    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);

  2. Anthony
    Anthony avatar
    19 posts

    Posted 07 Sep 2011 Link to this post

    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,
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Back to Top