How do I assert that a control is not visible on a web page


  • I have a <span> tag that when a button is clicked has its css style set to display:none

    How can i create an assert to verify this?

    Wednesday, August 24, 2011 9:45 PM


All replies

  • You should be able to add the Span control when it is visible on the screen;  You can write code where you assert on TryGetClickablePoint for you <span> control;


    Aditya Kumar Agrawal (MSFT)
    Thursday, August 25, 2011 4:17 AM
  • Yes...I agree with aditya...you should be able to add a control and then u can use..Assert.IsFalse(control.Exists)...as well


    Thanks, Narasimha Please mark it as answer, if this reply answerd your question
    Thursday, August 25, 2011 4:32 AM
  • Hi Chriso

    You can also check it's width property if it is positive it is visible as in not hidden although it might be scrolled off screen.


    Thursday, August 25, 2011 9:39 AM