Forum Discussion

leandropoblet's avatar
leandropoblet
Frequent Contributor
10 years ago

Type mismatch error on JScript function

Hi all,



I've been using this really simple function to click the rejectButton according to function parameters:



if (instance == 1)

  {

    switch (whichView)

    {

      case "List":

        var rejectButton = user1["PersonalQueueWorkList"]["RejectJobButton"];

        break;

      

      case "Tile":

        var rejectButton = user1["PersonalQueueWorkTile"]["RejectJobButton"];

        break;

    }

  }

  else

  {

    switch (whichView)

    {

      case "List":

        var rejectButton = user2["PersonalQueueWorkList"]["RejectJobButton"];

        break;

      

      case "Tile":

        var rejectButton = user2["PersonalQueueWorkTile"]["RejectJobButton"];

        break;

    }

  }

 

  if (userCanReject)

  {

    aqObject["CheckProperty"](rejectButton, "Enabled", cmpEqual, true);

 

    if (rejectJob)

    {

      rejectButton["Click"]();

    }         

  }

  else

  {

    aqObject["CheckProperty"](rejectButton, "Enabled", cmpEqual, false);

  }



There's 2 possible instances of the program: 1 or 2, and both of them have 2 'views' options: List or Tile.



Then userCanReject (or not) and rejectJob (or not) are boolean parameters.



Simple yet effective for my purposes.



Now the thing is it works on 99.99% of the cases but there's one where it throws an error: Type mismatch on this line: aqObject["CheckProperty"](rejectButton, "Enabled", cmpEqual, true);



It doesn't really make sense to me.... it's the same button, same instance, same parameters that other test cases use except this one fails and the others do what it's supposed to be done.



Any clues/suggestions?



Thanks in advance,

Leandro

1 Reply

  • jose_pita's avatar
    jose_pita
    Super Contributor
    I had the same problem while giving a presentation on testcomplete, this was embarassing!!!

    Try this:

    aqObject["CheckProperty"](rejectButton, "Enabled", cmpEqual, "True");