Alert Screenshot

Hi friends
How to take the screenshots of alert popup so that it should print on the generated html report.
Its really urgent. If anyone could help then i will be very thankful.

You can create a custom keyword following with the example from this page:

import java.awt.Robot as Robot
import java.awt.Toolkit as Toolkit
import java.awt.image.BufferedImage as BufferedImage
import javax.imageio.ImageIO as ImageIO
import org.openqa.selenium.Rectangle as Rectangle
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import as Mobile
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import internal.GlobalVariable as GlobalVariable
//Trigger the alert""))
//Capture the alert
BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
ImageIO.write(image, 'png', new File('C:\\yourImage.png'))

Hi Vinh Nguyen,
Thanks for your response.but With this keyword i am not able to get the screenshot in the Generated HTML Report, it goes to the specified location only.
So do you have any idea how to get this screenshot in the report.