cancel
Showing results for 
Search instead for 
Did you mean: 

wnd.Keys("112") enters 1122 rather than 112

SOLVED
Highlighted
Occasional Contributor

wnd.Keys("112") enters 1122 rather than 112

I have a script that should enter 112 into a text input field but instead it sometimes enter 1122. 

Code looks like this:

wnd.Keys("[BS][BS][BS]112[Enter]");

Sometimes it enters it correctly and other times it just doesnt, the biggest issue with this it crashes our dev build of the software so if I was to run a script overnight then it crashes when it gets to this point then the rest of the script wont run and thats wasted time.

Previous value in the input field so it is clearing the whole text input field before hand. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: wnd.Keys("112") enters 1122 rather than 112

Alternatively, see if the SetText method is available on the component.  That will remove the need for using the backspace and enter.  Also, this appears to be a "stutter" problem that happens sometimes with highly active web pages with regards to keystrokes.


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

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: wnd.Keys("112") enters 1122 rather than 112

I would step through it with Debug so you can see the test step execute and watch what is actually happening.  I am guessing that your backspaces are not always clearing the field and there are left over characters rather than the script entering different things.

Highlighted
Occasional Contributor

Re: wnd.Keys("112") enters 1122 rather than 112

The field would originally be populated with "65" so there is no chance that any characters would be left over. 

 

It doesnt always happen which is making is making the issue quite interesting, especially when this line is used maybe 7 times throughout this script that lasts maybe 2.5 minutes and the input field always begins with 65.

Highlighted
Community Hero

Re: wnd.Keys("112") enters 1122 rather than 112

And what happens when you step through it?

Highlighted
Occasional Contributor

Re: wnd.Keys("112") enters 1122 rather than 112

Watching it happen and the "65" is deleted and "1122" is entered into the text field input. The logs however say 

'[BS][BS][BS]112[Enter]' was sent as a keyboard input to the following window or control.
Highlighted
Contributor

Re: wnd.Keys("112") enters 1122 rather than 112

@Emerson,
Please try with the below code snippet
Wnd.keys("[Home]![End]")
Wnd.keys("[Del]")
Wnd.keys("122")

Please let me know if that solved your problem.

Kind regards,
Sathish Kumar k
Regards,
Sathish Kumar K
Highlighted
Community Hero

Re: wnd.Keys("112") enters 1122 rather than 112

Alternatively, see if the SetText method is available on the component.  That will remove the need for using the backspace and enter.  Also, this appears to be a "stutter" problem that happens sometimes with highly active web pages with regards to keystrokes.


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

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!