Reputation: 1551
This issues stems around Selenium, Jenkins, NUnit on a C# platform.
I have an application that calls a windows auth box for login. I ended up using Autoit to login and everything works great locally. When this is executed from Jenkins though, everything fails. I made some changes to the autoit script and my current failure is "Modal dialog present". (I used WinWait vs WinWaitActive)
My guess is that the exe is not being run when launched from Jenkins. Permissions Issues?
Jenkins is running on Windows 2012 R2 as a Master
C# code: System.Diagnostics.Process.Start(Path.Combine(base.BasePath, @"folder\autoitfile.exe"));
Anyone have ideas on what may be causing this?
Thanks!
Upvotes: 1
Views: 1364
Reputation: 456
I had the same problem. It turned out that in my case the window did not appear and the script kept waiting. I added the timeout parameter to the WinWaitActive method call, and now my script does not hang anymore. Also I had to let the active thread sleep for a while to be sure the user was logged in.
public void Login(string username, string password, int waitForit)
{
AutoItX.WinWaitActive(title: "Windows Security", timeout: 15);
AutoItX.Send(username);
AutoItX.Send("{TAB}");
AutoItX.Send(password);
AutoItX.Send("{ENTER}");
Thread.Sleep(waitForit);
}
Hope this helps fixing your problem.
Upvotes: 1
Reputation: 2946
When manipulating external application windows, always use #RequireAdmin in order to get the permission elevation. Also use Opt("WinSearchChildren", 1) in order to search child windows too. Play with "WinTitleMatchMode"
#RequireAdmin ;Will give your script a permission elevation (sometimes its needed)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinSearchChildren", 1) ;0=no, 1=search children also
Upvotes: 0