Forum Discussion

nastester's avatar
nastester
Regular Contributor
2 years ago

Issue with Visible/VisibleOnScreen detection

I have a script where I want to assert an object is no longer visible on screen after an action.

 

Both of these scripts pass when the object is humanly visible on screen:

aqObject.CheckProperty(Aliases.browser.pageDashboard.headerRelatedMessages, "Visible", cmpEqual, true);

aqObject.CheckProperty(Aliases.browser.pageDashboard.headerRelatedMessages, "VisibleOnScreen", cmpEqual, true);

 

When the object becomes humanly invisible on the the screen, these scripts fail:

aqObject.CheckProperty(Aliases.browser.pageDashboard.headerRelatedMessages, "Visible", cmpEqual, false);

aqObject.CheckProperty(Aliases.browser.pageDashboard.headerRelatedMessages, "VisibleOnScreen", cmpEqual, false);

 

This seems like it would be a very common use case so I assume I am just doing something wrong but not sure what..

  • I changed the CheckProperty to be "Exists" and it works..

     

    aqObject.CheckProperty(Aliases.browser.pageDashboard.headerSelectedMessage, "Exists", cmpEqual, false);

     

    Don't really understand why that works but not Visible but oh well, it is sufficient for my purposes.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    To check the property value of an object, the object must exist. If an error occurs when verifying the property value "Visible" or "VisibleOnScreen", then most likely it's relating to the object Aliases.browser.pageDashboard.headerRelatedMessages not existing. 

     

    At the point the object is "humanly invisible", Object Browser should show that particular object as being greyed out. 

    • nastester's avatar
      nastester
      Regular Contributor

      I changed the CheckProperty to be "Exists" and it works..

       

      aqObject.CheckProperty(Aliases.browser.pageDashboard.headerSelectedMessage, "Exists", cmpEqual, false);

       

      Don't really understand why that works but not Visible but oh well, it is sufficient for my purposes.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    "Don't really understand why that works but not Visible but oh well, it is sufficient for my purposes." - I provided an explanation ðŸ™„

     

    And the solution should have been,

    if (Aliases.browser.pageDashboard.headerRelatedMessages.Exists) {
      // Perform property checkpoint
    }