Does anyone know if there's a way to use NodeJs to drive Browserstack and capture a screenshot of a specific element on the page?
Thanks!
Does anyone know if there's a way to use NodeJs to drive Browserstack and capture a screenshot of a specific element on the page?
Thanks!
You can do it using PhantomJS.
Screenshot the entire page: Phantomjs - take screenshot of a web page
Screenshot cropped to the dimensions of a specific element: Crop screenshot to element in PhantomJS
More PhantomJS examples: https://github.com/ariya/phantomjs/wiki/Examples
The below given links give a sample to capture screenshot of an element using php. You can use it as a reference to write code in Node. If you face any problem, please feel free to ask.
https://github.com/facebook/php-webdriver/wiki/Taking-Full-Screenshot-and-of-an-Element
Exactly what you are looking for: