Environment.CurrentDirectory for RanorexAgent in 9.2.1

Ask general questions here.
Ajitpatil3011
Posts: 37
Joined: Thu Aug 22, 2019 4:14 pm

Environment.CurrentDirectory for RanorexAgent in 9.2.1

Post by Ajitpatil3011 » Wed Jan 15, 2020 3:37 pm

Hello there,
RanorexStudio version 9.0.1
I was using Environment.CurrentDirectory to get the project path("D:\MyAutomationProject\bin\Debug\") that is stored on my RanorexStudio machine. When I start the remote execution using RanorexAgent I was getting the same folder path("D:\MyAutomationProject\bin\Debug\") as RanorexStudio machine.

I recently updated my RanorexStudio to 9.2.1.
Now for Environment.CurrentDirectory my RanorexStudio still returns ("D:\MyAutomationProject\bin\Debug\") but Ranorex remote agent returns ("C:\Users\MyAutomationUser\AppData\Local\Temp\Ranorex\fb8e00cc2cd5cb018183c8708888f07c\").

Can someone please tell me how to get the same path from Ranorex remote agent?

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

Re: Environment.CurrentDirectory for RanorexAgent in 9.2.1

Post by odklizec » Wed Jan 15, 2020 3:43 pm

Hi

Use this code to get the working directory:

Code: Select all

TestSuite.WorkingDirectory.ToString();
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

Ajitpatil3011
Posts: 37
Joined: Thu Aug 22, 2019 4:14 pm

Re: Environment.CurrentDirectory for RanorexAgent in 9.2.1

Post by Ajitpatil3011 » Wed Jan 15, 2020 4:30 pm

Hi Pavel,

Thanks for your quick response.

I am still getting response as "C:\Users\MyAutomationUser\AppData\Local\Temp\Ranorex\fb8e00cc2cd5cb018183c8708888f07c\". :(

User avatar
Support Team
Site Admin
Site Admin
Posts: 12143
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Environment.CurrentDirectory for RanorexAgent in 9.2.1

Post by Support Team » Fri Jan 17, 2020 12:41 am

Hi Ajitpatil,

I am not sure why you were not seeing a different path before upgrading, but the current behavior is the expected behavior. This is because the Ranorex Remote Agent is copying the test to the remote machine's temp folder, hence why it is returning a different directory when run. If you are wanting it to return D:\MyAutomationProject\bin\Debug\ each time, specify this as a constant string instead of calling TestSuite.WorkingDirectory.

Cheers,
Ned
.
Image