Automatization with AutoIt, don´t show the screenshot

114 views
Skip to first unread message

Antonio Salazar Maldonado

unread,
Oct 17, 2014, 3:23:25 PM10/17/14
to jenkins...@googlegroups.com
Hi, the problem I have is that build a program in AutoIt (Automation Testing), this connects to the Database Access, select a form, then select a record and changes, certain activities the program creates a screenshots and recorded in JPG. In Window's done properly, by integrating this activity in Jenkins, the program generates the screenshot empty JPG in a dark frame.
Would appreciate your help.

-- Program in AutoIT
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <ScreenCapture.au3>
#include <Date.au3>

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Antonio Salazar Maldonado
;
; Script Function:


WinSetState("","",@SW_ENABLE)

;$caption = '\'
;_ScreenShot($caption)

; Run the Access
Run("C:\Program Files (x86)\Microsoft Office\Office12\msaccess.exe")

Sleep(2000)

; Navega por la opciones
Send("{TAB}")
SLEEP(1000)
Send("{TAB}")
SLEEP(1000)
Send("{TAB}")
Sleep(1000)
Send("{TAB}")
sleep(1000)
;Send("{TAB}")
;sleep(1000)
SEND("{ENTER}")
sleep(2000)

;Selecciona DB
$caption = '\'
_ScreenShot($caption)
sleep(1000)

MouseClick("LEFT",533,162,1)
sleep(1000)
;Send("ENTER")
MouseClick("LEFT",490,428,1)
sleep(1000)
;Send("ENTER")
MouseClick("LEFT",789,558,1)
sleep(1000)
MouseClick("LEFT",762,289,1)
sleep(1000)
Send("{ENTER}")
sleep(1000)

;Selecciona Tabla
$caption = '\'
_ScreenShot($caption)
Sleep(1000)

; Selecciona Registro y Modifica
MouseClick("LEFT",543,323,1)
sleep(1000)
MouseClick("LEFT",335,389,1)
sleep(1000)
Send("Prueba de Datos")
sleep(1000)

;Selecciona Alimenta Datos
$caption = '\'
_ScreenShot($caption)
Sleep(1000)

MouseClick("LEFT",713,107,1)
sleep(1000)
MouseClick("LEFT",1045,30,1)
sleep(1000)
; Selecciona Registro y Genera Error para Cacharlo
MouseClick("LEFT",543,323,1)
sleep(1000)
MouseClick("LEFT",1024,221,1)
sleep(1000)
Send("ABC")
sleep(1000)
MouseClick("LEFT",713,107,1)
sleep(1000)

; Selecciona el Error
$caption = '\'
_ScreenShot($caption)
Sleep(2000)

MouseClick("LEFT",687,427,1)
sleep(1000)
MouseClick("LEFT",1024,221,1)
sleep(1000)
Send("{BS 3}")
sleep(1000)
MouseClick("LEFT",713,107,1)
sleep(1000)
MouseClick("LEFT",1048,27,1)
sleep(1000)
MouseClick("LEFT",1337,7,1)
sleep(1000)


;Screen Shot function
Func _ScreenShot($caption)



; Capture full screen
;$hBmp = _ScreenCapture_Capture("", 0, 0, 796, 596)
$hBmp = _ScreenCapture_Capture("", 0, 0, 1366, 768)

$sDateTime =  _NowCalc()
$sDateTime =  StringReplace($sDateTime, '/', '')
$sDateTime =  StringReplace($sDateTime, ':', '')
$sDateTime =  StringReplace($sDateTime,' ', '_')

;$FileName = 'C:OutputFolder' & $Caption & $sDateTime & '.jpg'
$FileName = 'C:\Users\Antonio\Documents' & $Caption & $sDateTime & '.jpg'

; Save bitmap to file
_ScreenCapture_SaveImage($FileName, $hBMP)

EndFunc

;sleep(1000)

; Termina Prueba!


John Davies

unread,
Oct 22, 2015, 10:08:57 AM10/22/15
to Jenkins Users
Did you ever find a solution to this. I'm up against the same problem...trying to capture a screenshot in a program run from Jenkins.

Slide

unread,
Oct 22, 2015, 11:13:14 AM10/22/15
to Jenkins Users

Depending on your windows version and how you are running Jenkins, you may need to enable the service to interact with the desktop. This option is not available in later versions of Windows.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/97c22e3a-50e5-4d9a-ad6c-db8a48f0143a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages