Take Element Screenshot captures element outside of the viewport
Per https://w3c.github.io/webdriver/#take-element-screenshot "The Take Element Screenshot command takes a screenshot of the visible region encompassed by the bounding rectangle of an element."
I would expect the TakeElementScreenshot dimensions to be less than or equal to those of the viewport. However, in practice, it seems like the element is not clipped when it's very big.
System
- Version: 0.24.0
- Platform: Linux, Win7
- Firefox: 67.0
- Selenium: Java 3.141.59
Testcase
test.html
https://jsbin.com/feqabaweyu/edit?html,output
testcase.py
from selenium import webdriver
driver = webdriver.Firefox() driver.get('./test.html')
element = driver.find_element_by_tag_name('table') element.screenshot('./picture.png') driver.quit()
Got:

Want:

Stacktrace
N/A
Trace-level log
Can you please attach a link to a eg. https://jsbin.com example? So that there is an example page which can be used for investigation. Thanks.
For the record, we have a similar problem with the command to take a regular screenshot: https://bugzilla.mozilla.org/show_bug.cgi?id=1434313
I couldn’t find a bug on file for element screenshots.
Oops, I didn't realize GitHub would actually render the HTML in the post. I've updated the OP to point to https://jsbin.com/feqabaweyu/edit?html,output
Is there anything else I can do on my end to expedite this? I noticed it's still labeled "waiting for reporter feedback" and I don't think I can manually adjust that myself. Please let me know if there's still something inadequate about the issue description.
I believe we have all the information we need here. I’ve filed https://bugzilla.mozilla.org/show_bug.cgi?id=1560113 to track this problem specifically, although the fix is the same as for https://bugzilla.mozilla.org/show_bug.cgi?id=1434313.
I wanted to follow up. Are there plans to work on this eventually?
Sorry, but due to other priorities there are no plans yet for when we can get this fixed.