I'm using a basic C# class to manage automation of dialogs.
Here's the simplified version.
Code: Select all
using System;
using Ranorex;
namespace SmokeTest.Expose
{
public class BaseClass // named as required
{
private const String FormClass = "<class>"; // As appropriate
private readonly Form Form;
public BaseClass()
{
Form = Application.FindFormClassName(FormClass,1,true,2000); // I assume the form has already been created
if (Form != null) Form.GetControls();
}
public Boolean Exists
{ get { return (Form != null); } }
private Boolean Button(String Text)
{
if (!Exists) return false;
Control Control = Form.FindChildText(Text);
Boolean Success = (Control != null &&
Control.Enabled &&
Mouse.ClickControl(Control).Equals(0));
if (Success) Form.GetControls(); //Refresh Controls
return Success;
}
public Boolean Back
{ get { return (Exists && Button("< &Back")); } }
public Boolean Next
{ get { return (Exists && Button("&Next >")); } }
public Boolean Cancel
{ get { return (Exists && Button("Cancel")); } }
} }
I updated to (the free) 1.0.0, and this is now broken.
(and yes, I've reassigned my references to the new location of the Ranorex DLL's)
Tracing through the code, something in the Mouse.ClickControl() function is invalidating my Form variable (even though it's readonly)
Prior to the call it (the variable) reflects as a 'form', after it reflects as a 'Button'. I'm assuming it's something to do with the fact that the Mouse has clicked on a 'button' control
Cheers
Gryphyn