Forum Discussion

tyrus's avatar
tyrus
Contributor
9 years ago
Solved

Test for Object Visible

Hi How do you test for an object visibility in TC?

 

my mapped name:

 

Aliases.MyView_GUI.HwndSource_BinaryDialogView.BinaryDialogView.Grid.Viewbox.Grid.Border.Grid.TextblockReallyDeleteUserUsername

 

I assign the return value of the mapped name of above to a varaible as follows

 

var user = Aliases.MyView_GUI.HwndSource_BinaryDialogView.BinaryDialogView.Grid.Viewbox.Grid.Border.Grid.TextblockReallyDeleteUserUsername

 

then I test for Visible but it says can't find obejct and doesn't return anyhting

 

  if(user.Visible)
  {
    Log.Message("Visible");
  }
  else
  {
    Log.Message("Not Visible");
  }

 

 

why doesn't this work? TC gives me  "the object does not exist".... which it does and is active on the screen.

this should be easy what am I missing?

 

thanks

  • tyrus's avatar
    tyrus
    9 years ago

    great, thanks

2 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    TC would look for object property "visible" when object exists.
    but if by any chance it's not yet full created when you looking for property "visible",
    will fire error object not exist.
    so either you can use

    user.WaitProperty("Visible",true,2500)

    will waite for 2.5 second untill "visible" is true or continue.

     


    or you can write your code in side another if like

    if user.WaitProperty("Exists",true,2500){
    ........your code .......}

     

    Also create same scenario manually and make sure object could be accessed by object spy