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());
      }
    }
  }