Skip to content

Instantly share code, notes, and snippets.

@andreastt
Last active December 19, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreastt/5983873 to your computer and use it in GitHub Desktop.
Save andreastt/5983873 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset=utf-8>
<title>Parent node visible with absolutely positioned children, where ancestor overflow is hidden</title>
<style>
body {
overflow: hidden;
height: 0;
width: 0
}
.child { position: absolute }
</style>
<div id=parent>
<div class=child>grated</div>
<div class=child>cheese</div>
def test_parent_of_absolutely_positioned_elements_visible_where_ancestor_overflow_is_hidden(self):
"""When a parent's ancestor hides any overflow, absolutely positioned child elements are
still visible. The parent container is also considered visible by webdriver for this
reason."""
self.driver.get(self.webserver.where_is("element_state/absolute-children-ancestor-hidden-overflow.html"))
ancestor = self.driver.find_element_by_tag_name("body")
assert not ancestor.is_displayed()
children = self.driver.find_elements_by_class("child")
assert all(child.is_displayed() for child in children)
parent = self.driver.find_element_by_id("parent")
assert parent.is_displayed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment