Ranorex Spy shows wrong Enabled-state of Elegant.Ui-buttons

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
surszer
Posts: 8
Joined: Mon Jun 27, 2011 8:26 am

Ranorex Spy shows wrong Enabled-state of Elegant.Ui-buttons

Post by surszer » Mon Jun 27, 2011 9:08 am

Hello,

we are using Ranorex 3.0.2 for automated testing. The application that is tested uses Elegant.Ui controls in stead of Windows.System.Forms controls. Although (most of) the controls are correctly identified by Ranorex the values of their "Enabled"-property aren't right. The Ranorex Spy shows the value "true" for all of them, no matter what state the property actually has. I get the same results when accessing the values with code in Ranorex.

Is there a way to get the "real" state of the property?

Thanks

Surs

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

Re: Ranorex Spy shows wrong Enabled-state of Elegant.Ui-buttons

Post by Support Team » Mon Jun 27, 2011 2:41 pm

Hi,
surszer wrote:Is there a way to get the "real" state of the property?
Would it be possible to send us a Ranorex Snapshot of your entire application? This snapshot is very useful for further analyses. You can also try following methods for a WinForms Regards,
Peter
Ranorex Team
.
Image

surszer
Posts: 8
Joined: Mon Jun 27, 2011 8:26 am

Re: Ranorex Spy shows wrong Enabled-state of Elegant.Ui-buttons

Post by surszer » Tue Jun 28, 2011 2:56 pm

Hi there,

unfortunately I can't send you a snapshot.
So I'll try to tell you some details:
I actually try to get all the applications controls and check the "Enabled"-state of each. I use the generic "FindChildren"-method on the top-level form and afterwards on all its children and so on.
I got no results while using FindChildren<Ranorex.Control>() so I had to look for each type of control (buttons, textboxes, checkboxes...) individually like this:
private void assembleControls(Ranorex.Adapter a){
           foreach(Ranorex.TabPageList tbl in a.FindChildren<Ranorex.TabPageList>()){
              if(!_tabPageLists.Contains(tbl)){
        	assembleControls(tbl);
        	_tabPageLists.Add(tbl);
              }
        	}
      	    foreach(Ranorex.Container co in a.FindChildren<Ranorex.Container>()){
        		if(!this._containers.Contains(co)){
        			assembleControls(co);
        			_containers.Add(co);
        		}
      		}

            //same for all other control-types
}
So all types of controls are saved in separate lists. As far as I know there is no possibility to cast from Ranorex.Button (or a similar class like Ranorex.CheckBox) to Ranorex.Control so the solution you mentioned in your reply is unfortunately not an option for me. Can it be done differently?

Thanks

Surs

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

Re: Ranorex Spy shows wrong Enabled-state of Elegant.Ui-buttons

Post by Support Team » Tue Jun 28, 2011 6:18 pm

surszer wrote:I got no results while using FindChildren<Ranorex.Control>()
Getting a list of Controls only works for Windows Forms application. Does your application use Windows Forms controls? If so, use the FindDescendants to get all WinForms controls in your application:
IList<Ranorex.Control> allControls = myForm.FindDescendants<Ranorex.Control>();
surszer wrote:so I had to look for each type of control (buttons, textboxes, checkboxes...) individually like this
Otherwise, if it is not a WinForms application, it's much easier to just search for all elements using the generic Unknown adapter that will accept any element, then you don't need all the if/else clauses or for loops:
IList<Ranorex.Unknown> allElements = myForm.Find<Ranorex.Unknown>(".//");
surszer wrote:As far as I know there is no possibility to cast from Ranorex.Button (or a similar class like Ranorex.CheckBox) to Ranorex.Control
You cannot "cast", but you can use different adapter types for the same element. However, using the Control adapter will only work if the element corresponds to a Windows Forms Control, thereby supporting this adapter type. See following section in the Ranorex User Guide for more information:
http://www.ranorex.com/support/user-gui ... x-spy.html
surszer wrote:unfortunately I can't send you a snapshot.
Without a Ranorex snapshot or sample application it is difficult for us to analyze the issue. If you don't want (or are not allowed) to share a snapshot in the forum, could you send one to support_at_ranorex.com?
And can you tell us some more about the automated application? Which UI technology/framework does it use?

Regards,
Alex
Ranorex Team
.
Image