Forum Discussion

amit_bansal's avatar
amit_bansal
Occasional Contributor
6 years ago

Typing in a textarea from a variable

I am using keys method to type in a textarea and the value is saved in a variable. When I am passing this values in Keys Method. It using control keys and opens a new tab and start search in browser. May be it is typing CTRL F and CTRL N in the stored variable value. How to avoid that?

  • Is "SetText" and available option for that textarea?  You can try that instead of keys.

    I don't see anything specific in that XML that would create the behavior you're experiencing.  However, the "!" character is a "SHIFT" key and the [ usually denotes, in the Keys method, the start of a special keystroke of some sort like an F key or Esc (see https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-sys-desktop-pda/keys-method-sys-desktop-object.html#parameters). So, what may be happening is that those keystrokes are triggered and may be causing any number of un-expected behaviors as TestComplete attempts to turn them into the special commands.  Whenever you use the "Keys" method/action in TestComplete, you need to take these special characters in consideration and "escape" them so that they properly enter.

     

    This is why I suggest "SetText" because that doesn't trigger these special characters.

  • amit_bansal's avatar
    amit_bansal
    6 years ago

    Hi

    I did a workaround by doing a setTEXT in a textbox and then cutting from Textbox and pasting in a Textarea. It worked that ways.

    Thanks for your guidance.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If the value holds the '^' character, that would do it.  That character is used by TestComplete to denote a CTRL keystroke.

    • amit_bansal's avatar
      amit_bansal
      Occasional Contributor

      It does not contain "^". It is an XML data saved in a string variable. May be using a "tab". Any solution to avoid that. The XML is undergiven.

      <tasks>
          <task>
              <allowedit>0</allowedit>
              <emailformat>0</emailformat>
              <attachobject>0</attachobject>
              <ASSIGNVALUE/>
              <wfremindertype>1</wfremindertype>
              <wfreminderdays>0</wfreminderdays>
              <adddays>0</adddays>
              <emailbody/>
              <orderindex>400</orderindex>
              <duration>0</duration>
              <Name><![CDATA[Task 1]]></Name>
              <Description/>
              <taskType>8</taskType>
              <fromaddress/>
              <emailcc/>
              <Messagetype>10</Messagetype>
              <isuseutaroles>0</isuseutaroles>
              <rejectLabel/>
              <reviseLabel/>
              <approveLabel/>
              <optionsallowed/>
              <expectedrespondent>1</expectedrespondent>
              <messageheader/>
              <lockobject>0</lockobject>
              <durationinterval>DAY</durationinterval>
              <usevariablesyntax>0</usevariablesyntax>
              <saveasevent>0</saveasevent>
              <emailsubject/>
          </</tasks>task>
      </tasks>

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Is "SetText" and available option for that textarea?  You can try that instead of keys.

        I don't see anything specific in that XML that would create the behavior you're experiencing.  However, the "!" character is a "SHIFT" key and the [ usually denotes, in the Keys method, the start of a special keystroke of some sort like an F key or Esc (see https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-sys-desktop-pda/keys-method-sys-desktop-object.html#parameters). So, what may be happening is that those keystrokes are triggered and may be causing any number of un-expected behaviors as TestComplete attempts to turn them into the special commands.  Whenever you use the "Keys" method/action in TestComplete, you need to take these special characters in consideration and "escape" them so that they properly enter.

         

        This is why I suggest "SetText" because that doesn't trigger these special characters.