Ask a Question

SetText() exception not caught

SOLVED
mortenb123
Contributor

SetText() exception not caught

How can I catch this exception?

function setControlText(control, text) {
    //usage example 1: setControlText(txtUName, userName);
    //usage example 2: setControlText(passwordBox, ("1234[Enter]"));
    Log.Message("text to enter:" + text);
    try {
      clearControlText(control);
      control.SetText(text);
      control.Click(01, 01);
    } catch(e) {
      Log.Message(e.message + " ignored");
    }
}

 It fails at the SetText() line with this error:

Unable to perform the action because the text editor is disabled.    12:07:56    Normal            7.05
1 REPLY 1
rraghvani
Champion Level 3

Not all methods throw an exception, and SetText doesn't throw an exception.

 

See TestComplete Events, OnLogError Event which can capture the message.

cancel
Showing results for 
Search instead for 
Did you mean: