$node =
$this->session->
getPage()->
find($selector_type,
$selector);
if ($node === NULL
) { if (is_array($selector)) { $selector =
implode(' ',
$selector);
} throw new ElementNotFoundException($this->session->
getDriver(), 'element',
$selector_type,
$selector);
} // Check if the node is visible on the page, which is a prerequisite of
// being visible in the viewport.
if (!
$node->
isVisible()) { throw new ElementHtmlException($message,
$this->session->
getDriver(),
$node);
} $result =
$this->
checkNodeVisibilityInViewport($node,
$corner);
if (!
$result) { throw new ElementHtmlException($message,
$this->session->
getDriver(),
$node);
} } /**
* Tests that a node, or its specific corner, is not visible in the viewport.
*
* Note: the node should exist in the page, otherwise this assertion fails.
*
* @param string $selector_type
* The element selector type (css, xpath).
* @param string|array $selector
* The element selector. Note: the first found element is used.
* @param bool|string $corner
* (Optional) Corner to test: topLeft, topRight, bottomRight, bottomLeft.
* Or FALSE to check the complete element (default).
* @param string $message
* (optional) A message for the exception.
*
* @throws \Behat\Mink\Exception\ElementHtmlException
* When the element doesn't exist.
* @throws \Behat\Mink\Exception\ElementNotFoundException
* When the element is not visible in the viewport.
*
* @see \Drupal\FunctionalJavascriptTests\JSWebAssert::assertVisibleInViewport()
*/