public void assertTopmostElement ( By by ) { if ( ! isTopmostElementCheckApplicable ( by ) ) { LOGGER . warn ( "The element identified by '{}' is not a leaf node in the " + "document tree. Thus, it cannot be checked if the element is topmost. " + "The topmost element check cannot be performed and is skipped." , by ) ; return ; } LOGGER . info ( "Checking whether the element identified by '{}' is the topmost element." , by ) ; WebElement topmostElement = findTopmostElement ( by ) ; WebElement element = findElement ( by ) ; if ( ! element . equals ( topmostElement ) ) { throw new AssertionError ( format ( "The element '%s' identified by '%s' is covered by '%s'." , outerHtmlPreview ( element ) , by , outerHtmlPreview ( topmostElement ) ) ) ; } }
Asserts that the element is not covered by any other element .