Test failed after start in Windows Scheduler

Ranorex Studio, Spy, Recorder, and Driver.
cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Test failed after start in Windows Scheduler

Post by cwirek » Mon Jul 02, 2012 4:39 pm

I have a problem with running test in Windows Scheduler.
After running the test I get an error:

Unexpected exception occured: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
at Ranorex.Core.ElementEngine.CheckLicense(Boolean showDialogs)
at Ranorex.Core.ElementEngine.AssertLicense()
at Ranorex.Core.ElementEngine..ctor()
at Ranorex.Core.ElementEngine.get_Instance()
at Ranorex.Host.get_Local()

at line :
Host.Local.OpenBrowser("https://onet.pl/", "IE", "", false, false);

If I doubleclick the *.exe it runs fine, with no errors
My system is Windows Widows Server 2008 Standard

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Test failed after start in Windows Scheduler

Post by Support Team » Tue Jul 03, 2012 12:42 pm

Hi,

This is not really a Ranorex specific error, the message just stated that "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation", so why do you want to show a modal dialog?
You can try to comment the code out which creates the dialog, because then your code should properly run.

Regards,
Markus
Ranorex Support Team

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Test failed after start in Windows Scheduler

Post by cwirek » Tue Jul 03, 2012 1:32 pm

Hi

As i wrote above, error appears when Ranorex open a Browser (IE)
I'm not showing a modal dialog.

Error appear at marked (red) line.

Report.Log(ReportLevel.Info, "Website", "Opening web site 'https://onet.pl/' with browser 'IE' in normal mode.", new RecordItemIndex(2));
Host.Local.OpenBrowser("http://onet.pl/", "IE", "", false, false);
Delay.Milliseconds(0);

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Test failed after start in Windows Scheduler

Post by Support Team » Tue Jul 03, 2012 3:07 pm

Hi,

Sorry for my wrong suggestion, could it be that you are using the trial version of Ranorex Studio?
I also tested it on my local machine and it worked without any errors, I think its because of the "Evaluation Dialog".

Regards,
Markus
Ranorex Support Team

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Test failed after start in Windows Scheduler

Post by cwirek » Tue Jul 03, 2012 3:20 pm

Hi

I'm using Ranorex 3.2 Premium Node-Locked, but installed version is 3.3.
I'm also tested a replacement for Windows Scheduler - System Scheduler - and test ran correct.
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Test failed after start in Windows Scheduler

Post by Support Team » Tue Jul 03, 2012 4:02 pm

Hi,

I was on the wrong track, sorry.
Did you start it from the current session of the logged on user, because otherwise it will not work.
Did you select this specific option?
WindowsScheduler.jpg
Regards,
Markus
Ranorex Support Team
You do not have the required permissions to view the files attached to this post.

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: Test failed after start in Windows Scheduler

Post by cwirek » Tue Jul 03, 2012 4:13 pm

Hi

Now it's ok, thx for help

SaiD
Posts: 1
Joined: Fri Dec 14, 2012 3:56 pm

Re: Test failed after start in Windows Scheduler

Post by SaiD » Fri Dec 14, 2012 4:28 pm

Hello,
So what was your solution?
I have also Problems with showing messageboxes or other modal Dialoges.
My company had just bought Ranorex .
We didn't started yet with Ranorex, but we realy want to!

The manuel execution runs without any Problems, but when i start tests (not Ranorex. NUnit-Test!) as a Win Service, i get this stupid Error(Userinteractive Mode Stuff...) ...
Any Ideas?
I'am concerning about the same stuff with Ranorex on our Buildserver.
What is, in your point of view, the most elegant way to start Ranorextest automaticly ?
Is there any chance to avoid this Error? Maybe some calling parameters in the calling Script?
Best regards,
Said

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Test failed after start in Windows Scheduler

Post by Support Team » Mon Dec 17, 2012 12:36 pm

Hi,
SaiD wrote:The manuel execution runs without any Problems, but when i start tests (not Ranorex. NUnit-Test!) as a Win Service, i get this stupid Error(Userinteractive Mode Stuff...) ...
Any Ideas?
The problem is, that your automation code is running on a process that is not running as the currently logged on user. Therefore the process is not be able to interact with the desktop in any way. So, as Markus mentioned, make sure to start it from the current session of the logged on use.
SaiD wrote:I'am concerning about the same stuff with Ranorex on our Buildserver.
What is, in your point of view, the most elegant way to start Ranorextest automaticly ?
You might have a look at our CI integration blog posts which cover our recommended way of automatically build and execute automated tests.