geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

Take Element Screenshot captures element outside of the viewport

Open mtrea opened this issue 6 years ago • 7 comments

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: got

Want: want

Stacktrace

N/A

Trace-level log

trace.txt

mtrea avatar Jun 04 '19 01:06 mtrea

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.

whimboo avatar Jun 04 '19 06:06 whimboo

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.

andreastt avatar Jun 04 '19 06:06 andreastt

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

mtrea avatar Jun 04 '19 20:06 mtrea

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.

mtrea avatar Jun 19 '19 01:06 mtrea

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.

andreastt avatar Jun 19 '19 13:06 andreastt

I wanted to follow up. Are there plans to work on this eventually?

mtrea avatar Oct 22 '20 23:10 mtrea

Sorry, but due to other priorities there are no plans yet for when we can get this fixed.

whimboo avatar Oct 23 '20 19:10 whimboo