Hi there,
I am new to Ranorex and still evaluating the product. (looks good so far). I will try to explain this as clearly as possible.
I have a situation where I need to trigger a 'job' within an MMC application console. I want to be able to wait until the job has completed to validate the status and determine whether it was successful or not.
However as this is in an MMC window the status field does not automatically refresh and so teh refresh action needs to be clicked.
I can identify all of the fields but am unsure of how to do the 'loop' I guess this is a C# Question rather than Ranorx. I have tried googling for a solution but most of this covers how to repeat actions a set number of times and or for a number of rows etc.
I believe the following steps are required:
right click, start job
Click Refresh action
check status field -
- if 'status is running' click refresh again, check status again
- if status is 'Idle' - Job was successful - do something else
- if status is Failed - Job failed - do something else
Any advise would be very much appreciated
Many thanks
How to repeat actions until a status is met
-
- Posts: 52
- Joined: Fri Mar 21, 2014 4:22 pm
How to repeat actions until a status is met
- Attachments
-
- FYI
- MMC.PNG (14.66 KiB) Viewed 2451 times
-
- Posts: 52
- Joined: Fri Mar 21, 2014 4:22 pm
Re: How to repeat actions until a status is met
After a break and a sleep I was able to find my answers.
I also added a validation step at the end so I could pick up on any failures (not status Idle)
Code: Select all
public void Mouse_Click_Refresh()
{
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'XporterConsoleRootGroupcallXporte1.Actions.Refresh' at Center.", repo.XporterConsoleRootGroupcallXporte1.Actions.RefreshInfo);
string Status = repo.XporterConsoleRootGroupcallXporte1.CentreWindow.varJob_Status.Text;
Report.Info("Job Start Time:" + System.DateTime.Now.ToString());
while (String.Equals(Status, "Running"))
{
repo.XporterConsoleRootGroupcallXporte1.Actions.Refresh.Click();
Status = repo.XporterConsoleRootGroupcallXporte1.CentreWindow.varJob_Status.Text;
Delay.Milliseconds(3000);
}
Report.Info("Job Finish Time:" + System.DateTime.Now.ToString());
}
public void Validate_varJob_Status()
{
Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Completed='Idle') on item 'XporterConsoleRootGroupcallXporte1.CentreWindow.varJob_Status'.", repo.XporterConsoleRootGroupcallXporte1.CentreWindow.varJob_StatusInfo);
Validate.Attribute(repo.XporterConsoleRootGroupcallXporte1.CentreWindow.varJob_Status, "Text", "Idle");
}
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: How to repeat actions until a status is met
Hello houseofcutler,
I'm glad that you found a solution. Thank you for sharing your experience to the community.
Regards,
Robert
I'm glad that you found a solution. Thank you for sharing your experience to the community.
Regards,
Robert