Jump to content
sridhar_nvm

Issues in integrating autoit with Jenkins

Recommended Posts

We are trying to open a certain windows application and take a screenshot of that application and save it in a specific path through auto it script. It's working fine on my local machine triggered by Jenkins but the same code is not working on a remote server (multiple users can log in).  And we have provided the admin access inside services.msc for jenkins. When we start the Jenkins job it is able to call the autoit script and open the windows application which is the first line in the autoit script as well (it was running in the task manager) but somehow not able to complete the task and the job goes on running.

Share this post


Link to post
Share on other sites
Posted (edited)

Yes we are running auto script with admin privileges. Our code needs to interact with GUI but if we run it through jenkins on remote server it is running that as a background task. 

And this is our script

Run("notepad.exe")

$hWnd = WinWait("Untitled - Notepad", "", 10) 
WinActivate($hWnd)

Send("Sending some special characters:{ENTER 2}")

Send("{PRINTSCREEN}")

Send("!f")

Send("{UP 1}{ENTER}")

Send("{TAB}{ENTER}")

Run("mspaint.exe")

$hWnd = WinWait("Untitled - Paint", "", 10) 
WinActivate($hWnd)

Send("^v")

Send("^s")

WinWaitActive("[CLASS:#32770]")

Send("D:\scripts\ScreenshotPaint.jpeg")

Send("{TAB 3}{ENTER}")

If WinExists("Confirm Save As") Then
     Send("{TAB}{ENTER}")
EndIf

Send("!+{F4}")

This works flawlessly in local machine. When I run above script manually it works fine even in remote server but not with the Jenkins.

Edited by sridhar_nvm

Share this post


Link to post
Share on other sites
Posted (edited)
36 minutes ago, sridhar_nvm said:

but not with the Jenkins

Makes sense as that likely runs in the background, thus the Send() commands will fail. Use ControlSend() instead.

Jos

Edited by Jos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...