If we want to take the screenshot then we have to convert our WebDriver object into the screenshot object. we need to change the behavior of the drive to take the screenshot . We can do it by casting
We need to add capabilities in the chrome browser DESIRED CAPABILITIES IS THE CLASS WHO HELP TO CUSTOMIZED THE CHROME BROWSER. So first we need to create an object of the Desired Capabilities and then accept the SSL or Insure certificate. After this we need to create our local chrome driver option and provide the Desired Capabilities information to the local chrome driver option so that while creating the chrome driver object, we can pass the local chrome driver to pass the Desired Capabilities. below is the code to use.