Assert element is not visible in front-end (but hidden and exists in DOM)

yiannisyiannis Posts: 8

I have an element that is either hidden or visible in front-end. How do I verify when this is hidden from the user?

I tried Browser Contents -> Browser validation tool but it's options for expected value only reflect the DOM. The options do not check if the element is hidden or not. Is there another way?

Thanks in advance


  • jakubiakjakubiak Posts: 722 admin

    A hidden element could be hidden in one of two ways:
    1. The element is not present in the DOM
    2. The element is present in the DOM but has a property (or its parent has a property) that causes it to be hidden

    For the first case, you probably would need to add an XML Databank to the Browser Contents to validate that the element is not there. For the 2nd case, you need to know which property causes the element to be hidden, and configure the Browser Validation Tool to check the value of that property.

  • yiannisyiannis Posts: 8

    Thank you I did fix it by checking that the class="ng-hide" is not present for the specific element that I search.

Sign In or Register to comment.