02-09-2015, 07:41 PM
Hi All, I am new [typical] to QTP and I can't get the screenshot to work. I need to capture a screenshot of each screen that my script runs through for evidence sake.
If I have my understanding correct I need to create the function via the function definition generator tool?
The below is my script. However My screenshot code is failing every time. Can anyone help?
My appreciated in advance.
If I have my understanding correct I need to create the function via the function definition generator tool?
The below is my script. However My screenshot code is failing every time. Can anyone help?
My appreciated in advance.
Code:
'RegisterUserFunc "Browser", "CaptureBitmap", "fnCaptureBitmap1"
Browser("Santander UK").Page("Santander UK").Image("idUserMenu").Click
'login user'
Browser("Intranet Login").Page("Intranet Login").WebEdit("calias").Set "c0234599"
Browser("Intranet Login").Page("Intranet Login").WebEdit("cpassword").SetSecure "54d52cac4a591499190479343ef8adc2f850270e6a8074ed81545d5baee1"
'navigate to customer search'
Browser("Intranet Login").Page("Intranet Login").WebButton("OK").Click
Browser("Intranet Login").Page("Intranet Login").Frame("menuIzq").WebElement("Customer Database").Click
'search for customer'
Browser("Intranet Login").Page("Intranet Login").Frame("menuIzq").Link("Details Management").Click
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo").WebList("select").Select "Customer Number"
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo").WebEdit("WebEdit").Set "33809222"
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo").Link("Search").Click
'#####################
'Capture screenshot
'#####################
Public Function ScreenshotCapture(ByRef test_object)
'Browser("Intranet Login").Page("Intranet Login").CaptureBitmap "C:\QTP\Screenshots"
End Function
RegisterUserFunc "Image", "CaptureBitmap", "ScreenshotCapture"
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo_2").Link("Details").Click
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo_2").WebElement("0015").Click
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo_2").Link("Details").Click
Browser("Intranet Login").Page("Intranet Login").Frame("AreaTrabajo_2").Link("Address").Click
'################################
'Capture Screenshot
'################################
'Test End