Forum Discussion

ryan_buntrock's avatar
ryan_buntrock
Occasional Contributor
12 years ago

Elements not getting set

I have a java app I am trying to write a script against.



I seem to be having an issue on a specific screen in the app.



I basiclly want to enter into the screen... hit the F1 key... Enter an "O" in the claim status field and click F2.  Then fill in some other fields and  then verify those were entered correctly before saving the form.



Here is a copy of the code I have tried....Parts are commented out as I have tried a few different things.  Any help or advice on writing scripts on a java app would be great.



Thanks,



--------------------------------------------


Set Cover = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("Cover", "15"), 50)


  Set Claim_Status = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("St Required", "28"), 50)


  Set D_Required = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("D Required", "41"), 50)


  Set Claim_Amt = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("Claim Amt", "119"), 50)


  


  


   'Query Open Claim.


    Project.Variables.gClin.setfocus


    Claim_Status.click


    'sys.Keys("[F1]")


    Project.Variables.gClin.Keys("[F1]")


    aqUtils.Delay 1000


    Project.Variables.gClin.setfocus


    Claim_Status.click


    


    'Claim_Status.ztext="O"


    'Claim_Status.setText="O"


    


    Claim_Status.Keys("O")


    'sys.Keys("O")


    'Claim_Status.Keys("O")


    


    'Project.Variables.gClin.setfocus


    'sys.Keys("[F2]")


    Project.Variables.gClin.Keys("[F2]")


  


    'Grab the claim amount and then add it to the cover...


    varClaim_Amt=Claim_Amt.ztext


    'ShowMessage("varClaim_Amt=" & varClaim_Amt & "      Now should set the cover to the claim amount")


    


    Cover.ztext=varClaim_Amt


    'CR the claim


    Claim_Status.ztext="C"


    D_Required.ztext="R"















  • ryan_buntrock's avatar
    ryan_buntrock
    Occasional Contributor
    This seems to work.. but maybe there is a better way?  And why wouldnt I be able to set the ztext on this screen but can on other screens.



    ----------------------------------------------------------------






    Set Cover = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("Cover", "15"), 50)


     Set Claim_Status = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("St Required", "28"), 50)


     Set D_Required = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("D Required", "41"), 50)


     Set Claim_Amt = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("Claim Amt", "119"), 50)


     


     


      'Query Open Claim.


       Project.Variables.gClin.setfocus


       Claim_Status.click


       'sys.Keys("[F1]")


       Project.Variables.gClin.Keys("[F1]")


       aqUtils.Delay 1000


       Project.Variables.gClin.setfocus


       Claim_Status.click


       


       'Claim_Status.ztext="O"


       'Claim_Status.setText="O"


       


       'Claim_Status.Keys("O")


       sys.Keys("O")


       'Claim_Status.Keys("O")


       


       'Project.Variables.gClin.setfocus


       'sys.Keys("[F2]")


       Project.Variables.gClin.Keys("[F2]")


     


       'Grab the claim amount and then add it to the cover...


       varClaim_Amt=Claim_Amt.ztext


       'ShowMessage("varClaim_Amt=" & varClaim_Amt & "      Now should set the cover to the claim amount")


       


       Cover.ztext=varClaim_Amt


       


       


       'CR the claim


       Claim_Status.ztext="C"


       D_Required.ztext="R"


     


       'Set textbox values to variables...


       varCover=Cover.ztext


       varClaim_Status=Claim_Status.ztext


       varDenial=D_Required.ztext


       


       'Wait a second...  


       aqUtils.Delay 1000  


     


     'Check to see if its ok to Save....


     If (varClaim_Status <>"C") OR (varDenial <>"R")  OR (varCover <> varClaim_Amt) Then


       ShowMessage("STOP!!!!!....Please Check account. Check for C&R and claim Amount")


     End If







  • ryan_buntrock's avatar
    ryan_buntrock
    Occasional Contributor
    This is still not working 100% of the time.  Any ideas, tips, or changes...

  • Hi Ryan,


     


    The SetText method is provided by TestComplete only to a certain number of controls. You can find the list of all controls in the "SetText Action (Edit and Combo Box Controls)" article. If some of the controls used in your app are not on the list, this can explain why TestComplete cannot call the method.


     


    What exactly doesn't work at the moment?


     

  • ryan_buntrock's avatar
    ryan_buntrock
    Occasional Contributor
    When Debugging, it appears the objects are not recognized unless I pause on them for an extended period...



    Maybe this is the issue?

  • Hi Ryan,


     


    When did you assign the gClin variable? Try using the Refresh method to update the object before searching for the target child element:




    Project.Variables.gClin.Refresh()


    Set Cover = Project.Variables.gClin.FindChild(Array("AWTComponentAccessibleName", "AWTComponentIndex"), Array("Cover", "15"), 50)


    ...