Forum Discussion

MW_Didata's avatar
MW_Didata
Regular Contributor
2 months ago

Backticks in textboxes using the Keys command

Related to ticket from 2 years ago: 

testcomplete-questions/testexecute-enters-in-textbox/247032

Somehow, during the test run when using Keys, sometimes a ` (backtick) is entered into the field.

Over the last week, it happened twice at different times and in different projects.

Since the last 2 years, I have rewritten my tests from VB keyword tests to JS scripts, and this still happens. I can't reproduce it since it is intermittent.

Here are 2 examples:

  • When using textbox.Keys("[Enter]");
    It entered: `[Enter]
  • When using textbox.Keys("1000055[Enter]");
    It entered: '1000055[Enter]

I'm just hoping someone somewhere has seen this issue before. I really can't figure out how or why TC does this.

I'm runnning the tests via batch Sessioncreator with TaskScheduler

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    I haven't replied to all your reactions but I have tried/read everything you have posted, Unfortunately I still can't recreate the issue.

    Since creating the ticket the issue has not happend again. I expect it will happen again at some point and when it does I might update the ticket.

     

    Thanks for all your help everyone, Maybe sometime in the future someone with the same issue will find this ticket and he/she might have a fix.

    Untill that time I'll just keep ignoring the log errors when this happens.

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    As stated in previous ticket this does also happen in grids

    Of the 2 examples the 1st was on 05-12-24 at 21:22:51

    and the 2nd was on 01-12-24 at 22:21:27

    The days in between were all fine

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      So the issue is still occurring after 2 years!? 

      What is your keyboard language settings? Have you checked with your application developers, to see if there's anything that might cause this? Have you upgraded TestComplete since two years ago?

      I'm not sure if I have asked you before, but are you able to create a new project having this issue, and post it, so that we can have a look?

      • MW_Didata's avatar
        MW_Didata
        Regular Contributor

        This issue comes up every so often,

        Last week twice before that not sure.

         

        I think my KB language is set to Dutch

        I asked my developers and it doesn't seem like it comes from our side.

        I always update TC to the latest version.

        I can't create a project where this happens because I can't find why this happens, it is rare for it to happen and it happens anywhere in multiple projects.

        sometimes it works just fine for weeks, other times it happens twice a week

         

        I created a for loop to press Enter 2000 times on the same textbox and it does not seem to happen.

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Frequent Contributor

    Out of curiosity, how are you interacting with the field?

    Do you just send keys to the field, or tab / click so the cursor is in the field before you send keys?

    I click on the field to make sure my cursor is in the field before I send my keys, I don't have the large amount you have but never had problem with it.

    • MW_Didata's avatar
      MW_Didata
      Regular Contributor

      Just the keys method in most cases, After searching TC does over 3500 keys entries, so adding a click/focus before every one just isn't possible.

      • Hassan_Ballan's avatar
        Hassan_Ballan
        Frequent Contributor

        Before considering any course of action and for the sake of isolating such anomaly root cause, perhaps you could create an isolated test project to experiment with by looping to reproduce the problem. Once consistently accomplished, and in the same loop you can experiment with possible work arounds such as click in the field or lead the key strokes with Ctrl+A.

        Such suggestions are not the solutions, just ideas to help you move a step forward. Worst case scenario would be to apply work around to handful of fields that exhibit such odd behavior, and I think that would be a good idea.

  • JDR2500's avatar
    JDR2500
    Frequent Contributor

    A fascinating problem that I have never encountered before.  As with many problems I would suggest trying to workaround it.  The easiest method if it will work is to use SetText rather than Keys.

    If that's not an option, you could try the variable approach suggested by rraghvani. 

    Also, you could try clicking in the field first, selecting any existing contents, then entering the new value with the Keys method.  For example:
    TextBox.Click
    TextBox.Keys("^a123456[Enter]")

    Last idea, since it's intermittent it could be a performance problem in the test environment.  Try increasing the "Key pressing delay" by a few ms in the project properties.  That has resolved issues with keyboard input for me in some cases.

     

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Frequent Contributor

      Interesting find rraghvani, new avenue to investigate.

      I am familiar with international languages, and yes key combinations are used to invoke special characters. Definitely it is a sequence of events, and it would be easy to find if it was keyboard keys combination.

      Other than keys combinations, even if it is the root cause, would not be easy to isolate. However, when it happens, viewing the log sequence of events leading to that point may give an indication of how or why. 

      One way to find out, if possible, is to remove all other languages.