Forum Discussion

kankele's avatar
kankele
Occasional Contributor
9 years ago

JScript Runtime Error

I have a TestComplete v10.5 application that tests a WPF application. One line of my code runs w/o issues 90% of the time, the other 10% of the time, I get a JScript runtime error "Unable to call the method. Status: Pending". My code gets a TextBox with the FindChild method (var textBox = parent.FindChild(.....), the calls the Click method of the textBox (textBox.Click()). The line that calls the Click method is where the runtime error occurs. I have no idea what this message means or how to even begin to debug this issue. Any help would be greatly appreciated.

2 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    Is  it becourse your text box is not fully created when you call it;s methoed?

    can you try a bit delay before calling methoed.

    if 90% ok the means your code is correct but other 10% may be due to some delay in application and it can not access what suppose to.........

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      "can you try a bit delay before calling methoed."

       

      Is fine to see if it's a timing related problem in the first place.

       

      But you shoud not be using hard coded delays as a long term solution.

       

      Once you have concluded it is indeed a timing issue, use a helper function that checks for the existence/visibility/usability of the object before you try and use it. Or just extend the timeout in the project options for how long TestComplete will wait for an object before giving up and throwing an error.