Error: Incorrect Syntax Used For The Method

Problem:

This error could happen when we use wrong parameter types or parameter counts for a given method. Let’s take “Click” method as for example:

  • Method Click(
    Integer X [Optional],
    Integer Y [Optional],
    Integer MsClickLength [Optional]
    )

It has 3 parameters and all of them are optional. Each parameter has a parameter type. To call this method we should provide all methods, which we want to use, here are good examples:

  • Click 10, 20
  • Click 10
  • Click 10, 20, 500

If we have to use only the second parameter, we should provide all the previous ones even if they are optional: in our example, it is Integer X [Optional]. The default value we could take from the tooltip or method documentation page.

img2

  • Click 0, 10

There are bad examples:

  • Click 10, 20, 500, 1 [Too many parameters]
  • Click “10”, “20” [Click accepts only integers]
  • Click , , 500 [Need to provide default values even for optional values]

How to Resolve this problem:

  • Check the method parameters and correct them according to documentation
  • Each method in a tool has a tooltip, which describes the parameters

What to do:

As additional, all available methods you can find in the following places:

  • ZAPTEST How-To Pages
  • PDF Documentation which is distributed with a tool: please, use “1SCRIPT” main menu: “HELP” -> “PDF Documentation
  • ZAPTEST Tooltips and auto-completion when you write a “.” symbol