takeScreenshot method
Takes a screenshot of the current page
Implementation
Future<Uint8List?> takeScreenshot() async {
_checkDisposed();
if (_controller == null) {
throw ScrapingException.validation(
'Browser not initialized',
isRetryable: false,
);
}
try {
final screenshot = await _controller!.takeScreenshot();
return screenshot;
} catch (e) {
_log('Error taking screenshot: $e', isError: true);
return null;
}
}