Highlighted
Super Contributor.
Super Contributor.
1902 views

How to type text in textbox using javascript?

Jump to solution

Hello,

Firts of all: I know it's not that hard to type text into a text area using Truclient by means of a type step. However in my case it is not sufficient. I am scripting a legacy application which analyzes the characters one by one as they are typed into a text boxe real time. It tries to find a match from a list as soon as possible. I noticed however that Truclient often seems to make typo's when typing that are corrected almost instantly (you can notice this visually in develop script mode). Upto now this never gave me any problem because when the last character was typed into a text area all previous characters would be corrected by TC well in time before the submit button is clicked. In this case however, the occasional - temporary- typo's of TC sometimes lead to a wrong match which is not corrected by the application after TC corrects the typo. So that is giving me a hassle. I would like to avoid this by simply sending the string to be typed as one block to the browser test area. But I don't know how to do this. I expect I would have to use an evaluate JS on object step for this, but I need help with the javascript itself.

Any suggestions?

I am using VUgen 12.55

Regards,

Peet

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Valued Contributor.
Valued Contributor.

Hi,

 Try to change the “Typing interval” to minimum (1), and see if it helps. You can find this setting in Vugen: “Runtime Settings” > “Replay” > “General”.

 

If it doesn’t help you can use “Evaluate JavaScript” step with the following:

var elem = AUT.document.getElementById('<youElementID>');
elem.value = <someText>;

 

Hope it will help.

Eti Noked

View solution in original post

2 Replies
Highlighted
Valued Contributor.
Valued Contributor.

Hi,

 Try to change the “Typing interval” to minimum (1), and see if it helps. You can find this setting in Vugen: “Runtime Settings” > “Replay” > “General”.

 

If it doesn’t help you can use “Evaluate JavaScript” step with the following:

var elem = AUT.document.getElementById('<youElementID>');
elem.value = <someText>;

 

Hope it will help.

Eti Noked

View solution in original post

Highlighted
Super Contributor.
Super Contributor.

That piece of javascript worked brilliantly!

Thank you.

Peet

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.