Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black screenshot for element inside scrollable div but outside visible area #53

Open
andreabisello opened this issue Jun 13, 2016 · 1 comment

Comments

@andreabisello
Copy link

E.g.

you have a div

this div contains some elements

those elements height is higher than parent div height so your div is scrollable

if you try to assert element inside scrollable area but out of the visible area, you got a black screenshot.

this is the example code

    def test_scrollable_not_scrolled(self):
        self.driver.get('https://rawgit.com/abioneperhobby/needle/master/demo/scroll.html')
        self.assertScreenshot('#underscroll', 'not_scrolled')

    def test_scrollable_scrolled(self):
        self.driver.get('https://rawgit.com/abioneperhobby/needle/master/demo/scroll.html')
        self.driver.execute_script('document.getElementById("scrollable").scrollTop = document.getElementById("scrollable").scrollHeight')
        self.assertScreenshot('#underscroll', 'underscrolled')

in the example i open a page with a scrollable div. This scrollable div contains a green rectangle in the bottom. If you try to make assertion , you obtain a black square. In the second test, i scroll down the div before taking screenshot. Scrolling down the div, i obtain the true screenshot.

@andreabisello
Copy link
Author

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant