Search code examples
qtphp-uft

"Wrong number of arguments" error when trying to click on JavaStaticText object in QTP


I am facing an issue clicking on a JavaStaticText object in QTP while testing a Java application. I have added the objects to my object repository and named the JavaStaticText object "DEPLOY":

Here is my script :

Set Main = JavaWindow("MainScreen")
If Main.Exist Then
    Main.JavaButton("d").Click
Else
    print "Console is not present"
End If
Main.JavaStaticText("DEPLOY").Click

The script is throwing the following error at the last statement:

Wrong Number of Arguments or Invalid Property Assignment

I am out of ideas as to why this error is thrown!

Thanks in advance


Solution

  • According to the UFT help, clicking on JavaStaticText requires that you supply X and Y coordinates. Assuming all your identifiers are correct, you can try something like:

    Main.JavaStaticText("DEPLOY").Click 1, 1
    

    ... or 0, 0, or whatever you find appropriate and reliable for the given object.