Forum Discussion

DurgaPrasad's avatar
DurgaPrasad
Occasional Contributor
12 years ago

Object Does not Exist Exception having screen or button exist.

Hi,

  The following is the exception "YOU ARE TRYING TO CALL THE  WinformsObject METHOD OR PROPERTY OF THE "WinformsObject("App")" object that does not exist.

          Actually i am using WaitWinformsObject("form") function but it showing as the above exception. i had also tried to use refresh function Sys.Property("App").refresh(), as i found in the forum as solution but it failed.Also i cannot use Exist property as there are many objects like buttons,combo box,etc,. so,please provide any other solution. 







Thanks and regards,

Durga.

  • Hi Durga,


     


    Modify your code in the following way:


     


    w = Sys.WaitProcess("Spectrum",5000).WaitWinFormsObject("Spectrum",5000);


    if (w.Exists)


    {


      w1=w.WinFormsObject("panelControl1").WinFormsObject("xtbcMenus");


    }


     


    BTW, the time in the WaitWinFormsObject method is measured in milliseconds. 500 means 0.5 sec. It's a very short period for a timeout. 


     

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Durga,


     


    The correct syntax for the WaitWinFormsObject method is the following:




    var obj = p.WaitWinFormsObject("form", 5000);


     


    if (!obj.Exists)


      Log.Message("The object doesn't exist");


     


    //write code here if the object exists



  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Durga,


     


    Modify your code in the following way:


     


    w = Sys.WaitProcess("Spectrum",5000).WaitWinFormsObject("Spectrum",5000);


    if (w.Exists)


    {


      w1=w.WinFormsObject("panelControl1").WinFormsObject("xtbcMenus");


    }


     


    BTW, the time in the WaitWinFormsObject method is measured in milliseconds. 500 means 0.5 sec. It's a very short period for a timeout. 


     

  • DurgaPrasad's avatar
    DurgaPrasad
    Occasional Contributor
    Hi Tanya,

     a very Thankfull for your reply.


    i had changed the code as the following it worked for some cases but failed in many places.


     


        Sys.Process("Spectrum").Refresh();


            


        for(var i=0;i<4;i++)


        {


           w = Sys.WaitProcess("Spectrum",500,1).WaitWinFormsObject("Spectrum",500)


           w1=w.WinFormsObject("panelControl1").WinFormsObject("xtbcMenus");


           if(w1.Exists)


              break;


        }

    I got Exception as

    The Object Does not Exist. see Additional information as below

    You are trying to call the "WinFormsObject" method or property of the "WinFormsObject("Spectrum")" object that does not exist. 





  • DurgaPrasad's avatar
    DurgaPrasad
    Occasional Contributor
    Hi Tanya,



    thank you for reply.i had updated code and reply you after executing whole run of our code



    thank and regards,

    Durga.