Add capturePageContent(); Avoid drupal_basename()
drupal_basename() is now a method on a service in D9. Instead of wrapping that, create a captureScreenshot() method that uses filename logic refactored out of ScreenShotTrait.
Edited by Moshe Weitzman