Unable to verify Element Visibility for IF statement.

6 posts, 0 answers
  1. Ajit
    Ajit avatar
    1 posts
    Member since:
    Dec 2014

    Posted 19 Jan 2015 Link to this post

    Hi All,

    I am Unable to verify Element Visibility for IF statement.

    The scenario is I am using test step(Quick Step) as "Verify if Visible"
    But getting this Exception in case of failure(Element is not visible.).

    '*/**/**** 1:56:17 PM' - 'Fail' : 38. IF (Verify element 'ELEMENT_Tag' 'is' visible.)
    '*/**/**** 1:56:17 PM' - Unable to determine logical branch to go into. Unable to execute verification.

    Failure Information:
    ~~~~~~~~~~~~~~~
    Unable to locate element. Details: Attempting to find [Html] element using
    Find logic
     (Html): [tagname 'Exact' h1] AND [TextContent 'StartsWith' Server Error in]

    Unable to locate element. Search failed!

    Learn more about finding elements here:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/troubleshooting_guide/test-execution-problems/unable-to-locate-element.aspx
    ------------------------------------------------------------
    '*/**/**** 1:56:17 PM' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.


    Please let me know the solution ASAP.

    Thanks,
    Ajit.
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 21 Jan 2015 Link to this post

    Hi Ajit,

    It's a common misconception that "Verify is visible" is testing whether or not the target UI element can be seen within the browsers window. It actually isn't testing that. The "Verify if Visible" step assumes the element exists somewhere in the browsers DOM (but could be hidden underneath another element or scrolled out of view). Test Studio is checking the visibility state of the element which could be set via CSS and a class name. It's looking for an attribute like "DISPLAY: NONE". If this is present the element is not visible and the browser won't try to paint it. If this attribute is not present the element is visible and the browser will try to paint at at the appropriate time.

    However if the element does not exist in the browsers DOM, Test Studio is unable to test the visibility property. Thus you are getting the error "Unable to locate element. Search failed!". It's sort of like asking "is the color of this car Red" when there is no car to look at. Test Studio is coming back and saying "What car?".

    You most likely want to replace your "Verify If Visible" with a "Verify Element Exists" step.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 21 Jan 2015 in reply to Cody Link to this post

    Cody,

    I don't know if there is already a feature request for this or not - but I have always wished Verify Visible and Wait for Visible would return false (instead of throwing an exception) when the element does not exist.  I think this would be perfectly acceptable behavior.  Going with your analogy - if the red car does not exist, then it is not visible :).

    This would make test code more concise - as we then don't have to check for existence and then check for visibility (in a nested if statement).  You could write something to the log or have an option to handle those scenarios where the test does need to distinguish between existence and visibility.

    Shashi
  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 24 Jan 2015 Link to this post

    Hi Shashi,

    Tell you what, we have this public feed back portal where customers such as yourself can create their own feature requests. Would you mind creating one in your own words how you feel Verify Visible and Wait for Visible should behave? Our development team monitors these requests very closely. The more up votes it gets, the higher the priority it gets in our large list of all feature requests.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  5. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 24 Jan 2015 in reply to Cody Link to this post

    I have already expressed this on the Feature Request page - see my comment from October 2014 in http://feedback.telerik.com/Project/161/Feedback/Details/127428-what-a-verify-isvisible-actually-does-is-not-intuitive .  I also liked the feature request.

    Shashi
  6. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 25 Jan 2015 Link to this post

    Hi,

    That's great! Thanks.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top