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

Ranorex Spy, Recorder, and Studio.
boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Tue Aug 06, 2019 1:49 pm

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
2019-08-06 14_39_08-Shared Elements - Ranorex Studio - (32bit).png (10.45 KiB) Viewed 129 times
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

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Tue Aug 06, 2019 1:58 pm

Screen shot of error message:
2019-08-06 14_43_08-Greenshot.png
2019-08-06 14_43_08-Greenshot.png (46.21 KiB) Viewed 129 times

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Tue Aug 06, 2019 2:14 pm

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?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Tue Aug 06, 2019 2:18 pm

Hi,

Have you tried to add the path both to File Name and Working Directory fields?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Wed Aug 07, 2019 3:19 pm

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

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Wed Aug 07, 2019 3:29 pm

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.

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Fri Aug 09, 2019 8:50 am

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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Fri Aug 09, 2019 9:22 am

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);
        }
    }
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 27
Joined: Wed Mar 13, 2019 9:02 am

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

Post by boegvald » Fri Aug 09, 2019 9:41 am

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Fri Aug 09, 2019 9:50 am

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/
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration