src/DrupalExtension/Context/VisibilityContext.php
protected function assertElementNotVisible($element, NodeElement $node) {
    try {
      if ($node && $node->isVisible()) {
        throw new ExpectationException(sprintf("The field '%s' was present on the page %s and was not supposed to be", $element, $this->getSession()->getCurrentUrl()), $this->getSession());
      }
    }
    catch (UnsupportedDriverActionException $e) {
      // We catch the UnsupportedDriverActionException exception in case
      // this step is not being performed by a driver that supports javascript.
      // All other exceptions are valid.
      if ($node) {
        throw new ExpectationException(sprintf("The field '%s' was present on the page %s and was not supposed to be", $element, $this->getSession()->getCurrentUrl()), $this->getSession());
      }
    }
  }
protected function assertElementNotVisible($element, NodeElement $node) {
    try {
      if ($node && $node->isVisible()) {
        throw new ExpectationException(sprintf("The field '%s' was present on the page %s and was not supposed to be", $element, $this->getSession()->getCurrentUrl()), $this->getSession());
      }
    }
    catch (UnsupportedDriverActionException $e) {
      // We catch the UnsupportedDriverActionException exception in case
      // this step is not being performed by a driver that supports javascript.
      // All other exceptions are valid.
      if ($node) {
        throw new ExpectationException(sprintf("The field '%s' was present on the page %s and was not supposed to be", $element, $this->getSession()->getCurrentUrl()), $this->getSession());
      }
    }
  }
protected function assertElementNotVisible ( $ element , NodeElement $ node ) { try { if ( $ node && $ node -> isVisible ( ) ) { throw new ExpectationException ( sprintf ( "The field '%s' was present on the page %s and was not supposed to be" , $ element , $ this -> getSession ( ) -> getCurrentUrl ( ) ) , $ this -> getSession ( ) ) ; } } catch ( UnsupportedDriverActionException $ e ) { // We catch the UnsupportedDriverActionException exception in case // this step is not being performed by a driver that supports javascript. // All other exceptions are valid. if ( $ node ) { throw new ExpectationException ( sprintf ( "The field '%s' was present on the page %s and was not supposed to be" , $ element , $ this -> getSession ( ) -> getCurrentUrl ( ) ) , $ this -> getSession ( ) ) ; } } }
Assert non visibility of an element.

@param string $element
Element selector or a string that describes it.
@param \Behat\Mink\Element\NodeElement $node
Node representing the element above, if any.

@throws \Behat\Mink\Exception\ExpectationException
Throws exception if element is found.
Assert non visibility of an element .