Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
8 years ago

How to Add/Delete/Read text to/from 'TextArea'

Hello,

Using TestComplete, I'm interacting with 'TextArea' object on the Web. What methods are available or can be used to Edit the Text /Remove the Text To/From this Object? would also like to fetch the current text populated in the TextArea.

 

Thank you

Abhi

  • I figured it out... using keys method I can actually enter the text value.

    here's an example:

     

    //to type the text 'Take it easy!' in a textarea

    TextAreaObject.Keys("Take it easy!");

     

     

    Thank you

    Abhi

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    There should be a "Text" or "wText" property on the object that will contain the value within the TextArae.

     

    As for adding...  Probably your best bet would be to send a Keys action to the TextArea.  As for deleting what's there, what we've done here is using Keys simply send '^a[BS]' which selects the entire contents of the area and deletes it using the BackSpace key.

    • Adagio's avatar
      Adagio
      Frequent Contributor

      Thanks Robert. Typing the text using Keys action is something I'm trying to avoid. That's a very 'Manual' sort of process.

      I'm trying to find a better way of doing this. For textboxes I'd never faced this trouble, but for textarea, it's really strange. 

       

      Thank you

      Abhi

      • Adagio's avatar
        Adagio
        Frequent Contributor

        I figured it out... using keys method I can actually enter the text value.

        here's an example:

         

        //to type the text 'Take it easy!' in a textarea

        TextAreaObject.Keys("Take it easy!");

         

         

        Thank you

        Abhi