selenium python element.screenshot() not working selenium python element.screenshot() not working selenium selenium

selenium python element.screenshot() not working


It doesn't look like you can screenshot a particular element with selenium alone. See here, for example: How to take screenshot of element using python3 and selenium.

There are workarounds such as this: How to take partial screenshot with Selenium WebDriver in python?.

You can also take a screenshot of the page and crop it. In that case, these work:

browser.get_screenshot_as_file('/example/file/path.png')

or

browser.save_screenshot('/example/file/path.png')