Hi,
I have been looking in the API for a current project directory but I can not find something like that.
Where can I look?
Thanks
Path to project directory
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Path to project directory
Hi Mayra,
Unfortunately there is no direct method to get the path of the project folder.
There is the possibility to use this little workaround:
The Directory Class can be found in the System.IO Namespace.
Kind regards,
Markus (S)
Unfortunately there is no direct method to get the path of the project folder.
There is the possibility to use this little workaround:
Code: Select all
string path = Ranorex.Core.Testing.TestSuite.WorkingDirectory; //Returns the path to the Bin/Debug Folder of your project
string parentpath = Directory.GetParent(path).ToString(); //returns the path to the Bin/ Folder of your project
string grandparentpath = Directory.GetParent(parentpath).ToString(); //Returns the Parentfolder of your Bin/ Folder
Report.Info("Path", path);
Report.Info("ParentPath", parentpath);
Report.Info("GrandParentPath", grandparentpath);
Kind regards,
Markus (S)
Re: Path to project directory
Hi,
I've tried above approach in Ranorex 5.4.4 (in a UserCode.cs) but
is NULL
Could you please advise?
Thanks,
Mau.
I've tried above approach in Ranorex 5.4.4 (in a UserCode.cs) but
Code: Select all
Ranorex.Core.Testing.TestSuite.WorkingDirectory
Could you please advise?
Thanks,
Mau.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Path to project directory
Hi maulemon,
Usually, this happens when running only the module itself. In general you have to run your UserCode Module as part of a Test Suite in order to get the working directory correctly.
Regards,
Manuel
Usually, this happens when running only the module itself. In general you have to run your UserCode Module as part of a Test Suite in order to get the working directory correctly.
Regards,
Manuel
Re: Path to project directory
HI ,
Even i ran my user code am not able to get the Path, its showing NULL Still.
Ranorex.Core.Testing.TestSuite.WorkingDirectory;
Could you please help us.
Regards,
Arunlal
Even i ran my user code am not able to get the Path, its showing NULL Still.
Ranorex.Core.Testing.TestSuite.WorkingDirectory;
Could you please help us.
Regards,
Arunlal
Re: Path to project directory
Hi Arunlal,
As mentioned in Manuel's post (post before yours), you must run entire "test suite" and not just the standalone recording/code module containing this code! The method TestSuite.WorkingDirectory is TestSuite related so you must run entire test suite.
As mentioned in Manuel's post (post before yours), you must run entire "test suite" and not just the standalone recording/code module containing this code! The method TestSuite.WorkingDirectory is TestSuite related so you must run entire test suite.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Path to project directory
HI Odklizec,
Sorry, yeah i have ran my entire test suite only, but even am facing the same Error as NULL.
Did i made any mistake in this.
My scenario is, From an web application i have to click the browse button and i have to upload a document from the path where i have stored my doc.
Could you please help on this.
Regards,
Arunlal
Sorry, yeah i have ran my entire test suite only, but even am facing the same Error as NULL.
Did i made any mistake in this.
My scenario is, From an web application i have to click the browse button and i have to upload a document from the path where i have stored my doc.
Could you please help on this.
Regards,
Arunlal
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Path to project directory
Hello Arunlal,
Would you mind sending an e-mail to [email protected]. We can schedule a remote session in order to analyze the issue in more detail on your machine directly. This would be easier because we can see how exactly your test looks like.
Regards,
Bernhard
Would you mind sending an e-mail to [email protected]. We can schedule a remote session in order to analyze the issue in more detail on your machine directly. This would be easier because we can see how exactly your test looks like.
Regards,
Bernhard
Re: Path to project directory
HI Bern,
we should not share our machine from here as its confidential.
we should not share our machine from here as its confidential.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Path to project directory
Hello Arunal,
Please try the following:
Sincerely,
Robert
Please try the following:
Code: Select all
var projectDirectory = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName;
Robert