Ask a Question

Typing in a textarea from a variable

SOLVED
amit_bansal
Occasional Contributor

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?

4 REPLIES 4
tristaanogre
Esteemed Contributor

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


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
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>

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-deskto...). 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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
amit_bansal
Occasional Contributor

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.

cancel
Showing results for 
Search instead for 
Did you mean: