Page 1 of 1

"Run application" only works when executed within the recording module

Posted: Tue Aug 06, 2019 1:49 pm
by boegvald
I am using the windows tskill command to make sure all Chrome services are stopped ("tskill chrome*"):
2019-08-06 14_39_08-Shared Elements - Ranorex Studio - (32bit).png
It works when running the recording module directly. But when running the entire test case, it can't find the file:

"Failed to run application.... The system cannot find the file specified" (trying to add screen shot in comments, as adding multiple images doesn't seem to work for me)..

Why this difference? Privileges? Whitelist? Path? Other? I haven't been able to figure it out...

Best Regards
Bo

Re: "Run application" only works when executed within the recording module

Posted: Tue Aug 06, 2019 1:58 pm
by boegvald
Screen shot of error message:
2019-08-06 14_43_08-Greenshot.png

Re: "Run application" only works when executed within the recording module

Posted: Tue Aug 06, 2019 2:14 pm
by boegvald
I tried adding the path (c:\Windows\System32) and adding tskill to the whitelist... no change... What kind of (probably) obvious thing am I missing?

Re: "Run application" only works when executed within the recording module

Posted: Tue Aug 06, 2019 2:18 pm
by odklizec
Hi,

Have you tried to add the path both to File Name and Working Directory fields?

Re: "Run application" only works when executed within the recording module

Posted: Wed Aug 07, 2019 3:19 pm
by boegvald
Thanks much for getting back to me, Pavel. So much appreciated.

I tried your suggestion, but with same result: Works fine when run within the recording module. Fails when run via suite/test case.

Also, I tried a few other things:
- Running the snippet tool (same folder) give the same result
- Running applications in other folders (like Chrome) works, both when run from within the recording module, and when run via test case/test suite!
- Copying tskill.exe to my Desktop, and running this version instead works!!

It seems like there are some special challenges when trying to run application in the C:\Windows\System32 folder...

My first though was that maybe som background redirection took place, like:
https://docs.microsoft.com/en-us/window ... redirector

But I can't find tskill.exe in any other Windows folder....

Any thoughts?

Best Regards
Bo

Re: "Run application" only works when executed within the recording module

Posted: Wed Aug 07, 2019 3:29 pm
by boegvald
I just saw that there is a tskill.exe.mui file in C:\Windows\System32\en-US.... could it be a language related problem? As I remember, my Windows installation is in Danish by I changes this to English when I got the PC.... just thoughts... will look further into this tomorrow.

Re: "Run application" only works when executed within the recording module

Posted: Fri Aug 09, 2019 8:50 am
by boegvald
I tried running the test on another computer. Works perfectly. I guess the reasons it does not work on my PC is the change of the Windows display language, but don't have the skills to investigate this further.

There are a lot of articles on the internet describing problems running applications in the c:\Windows\System32 folder.

Re: "Run application" only works when executed within the recording module

Posted: Fri Aug 09, 2019 9:22 am
by odklizec
Hi,

It's really weird. Anyway, I think you can easily avoid using tskill with killing process via code? I'm using something like this for IE, but I'm sure you can adapt it for Chrome:

Code: Select all

using System.Diagnostics;	
    try
    {
        IList<Ranorex.WebDocument> webList = Host.Local.Find<Ranorex.WebDocument>("/dom[@domain='ondemand.qa.descartes.com']");
        Report.Log(ReportLevel.Info, "Application", "Closing all IE instances.");
        foreach (Ranorex.WebDocument webdoc in webList)
        { 
            webdoc.Close();
        }
    }
    catch(Exception exBrowserClose)
    {
        Report.Warn("An error occured while an attempt to close browser: " + exBrowserClose.ToString());
        // try kill iexplore process           	
        try
        {
            foreach (var procIE in Process.GetProcessesByName("iexplore"))
            {
                procIE.Kill();
                Report.Warn("Process Kill", "Process " + procIE.ToString() + " found and killed.");
            }
        }
        catch(Exception exProcKill)
	{
            Report.Warn("Process Kill failed", "Process iexplore found but Process Kill failed... " + exProcKill.Message);
        }
    }

Re: "Run application" only works when executed within the recording module

Posted: Fri Aug 09, 2019 9:41 am
by boegvald
Thanks much, Pavel. I am in the 'early stage" of learning C# programming in a Windows/.Net environment, so your sample is very valuable.

Now, I will go learn how to use Pop Up Watchers.... because a Chrome message about reloading pages sometimes pop's up when I have killed the Chrome process... Hmm... is this a never ending path... :-)

Best Regards
Bo

Re: "Run application" only works when executed within the recording module

Posted: Fri Aug 09, 2019 9:50 am
by odklizec
You are welcome. I'm using popupwatcher too, mostly for Chrome and its obtrusive "restore pages" popup which cannot be disabled and often blocks controls under it. Its implementation is quite easy since the introduction of automation helpers. You can find a very nice "automation helpers" video tutorial here:
https://www.ranorex.com/resources/