Expanding on the existing helpers for screenshot and responsiveScreenshots this new helper is for taking a screenshot of a specific element, by passing in the $selector for the element and then using the takeElementScreenshot() method of the RemoteWebElement::class.
As the element needs to be 'in view' before the screenshot can be taken, the helper first calls scrollIntoView before taking the screenshot.
Of course, the same could be achieved by adding a Browser::macro in the service provider, but this pull request would put it alongside the existing methods and include in the package.
Tests have been included that follow a similar pattern as those for the screenshot method.
Expanding on the existing helpers for
screenshot
andresponsiveScreenshots
this new helper is for taking a screenshot of a specific element, by passing in the$selector
for the element and then using thetakeElementScreenshot()
method of theRemoteWebElement::class
.As the element needs to be 'in view' before the screenshot can be taken, the helper first calls
scrollIntoView
before taking the screenshot.Of course, the same could be achieved by adding a
Browser::macro
in the service provider, but this pull request would put it alongside the existing methods and include in the package.Tests have been included that follow a similar pattern as those for the
screenshot
method.