I am trying to run a shell command within my test using runapplication. however, I also want to wait for that to complete before my scripts continue and carry on. Is there a way of doing this?
I can manually add a delay after using runapplication, however, I wanted the test to bit smarter than that and to wait til it completes.
Is it possible to wait for a runapplication to complete
Re: Is it possible to wait for a runapplication to complete
Hi,
Try for example Wait For Not Exists action. Set a reasonable timer based of your experience with the execution time of your shell script. If you set the timer too low, the next action will be started before the shell script is finished! Just "Wait" action right after the action where you start the shell command... Eventually, you can do something similar from code, using the process name and while loop with timeout...
Try for example Wait For Not Exists action. Set a reasonable timer based of your experience with the execution time of your shell script. If you set the timer too low, the next action will be started before the shell script is finished! Just "Wait" action right after the action where you start the shell command... Eventually, you can do something similar from code, using the process name and while loop with timeout...
using System.Diagnostics; public void Wait_For_Not_Exist_code() { int ElapsedTime = 0; while (Process.GetProcessesByName("cmd").Length >= 1 && ElapsedTime < 300000) { Thread.Sleep(1000); ElapsedTime += 1000; } }Hope this helps?
You do not have the required permissions to view the files attached to this post.
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: Is it possible to wait for a runapplication to complete
I have decided to use system.diagnostics and use the new process and within that use process.waitforexit etc
This seems to be working as expected.
Thanks for your suggestion.
This seems to be working as expected.
Thanks for your suggestion.
Re: Is it possible to wait for a runapplication to complete
You are welcome. And thanks for sharing your solution!
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