Ranorex Spy: Issue with Toolstrip control in .Net 2005

Ranorex Studio, Spy, Recorder, and Driver.
hoanglz
Posts: 11
Joined: Wed Sep 30, 2009 7:17 am

Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by hoanglz » Thu Oct 01, 2009 11:12 am

Hi Ranorex,

I try to use Ranorex to detect the button insite a ToolStrip control:
Please refer to my picture:
1) Press "Show All", four button will visible in the application.Spy work fine, it can detect four button
2) Press "Hide Button3", and the button3 in the ToolStrip will be hide.
3) Ranorex Spy can not detect button3 in ToolStrip anymore.
I think the right behavior should be: Button3 is detected in the ToolStrip, and the property "Visible" = "False"

If following this way, I can not verify status of button3 in my application.

Best regards,
HoangLX.
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by Support Team » Thu Oct 01, 2009 1:20 pm

Hi hoanglz again!
The visible property can only be validated for controls i.e. we don`t show unvisible toolstrip buttons (non control elements) in the Element Tree because of structure representation and performance reasons.
Check the button visibility by using the Find("relativePathToButton") method from the Ranorex toolstrip element. If the element is invisible (or doesn`t exist), the method returns an empty list - so you can check if the returned list is empty.

Regards,
Christian
Support Team

hoanglz
Posts: 11
Joined: Wed Sep 30, 2009 7:17 am

Re: Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by hoanglz » Mon Oct 05, 2009 8:09 am

hi Christian,
humm, I think Ranorex should list all control in ToolStrip.
"Hidden button" is different from "Not exist button". :mrgreen:

Thank you for fast support.
Best regards,
HoangLX.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by Support Team » Mon Oct 05, 2009 8:43 am

hoanglz wrote:humm, I think Ranorex should list all control in ToolStrip.
"Hidden button" is different from "Not exist button". :mrgreen:
We would like to show all the elements inside the .NET ToolStrip, however, the currently used technology (MSAA) for getting elements inside that tool strip does not report invisible buttons. So, not Ranorex is filtering the invisible button, but the control is by not conveying information about invisible buttons to Ranorex.

In general, that is the default behavior for all technologies. Only visible elements are reported by Ranorex, since these are the only elements a user can interact with. So, instead of validating whether your button is visible, you should check whether the button exists by searching for it (like Christian posted).

Regards,
Alex
Ranorex Support Team

hoanglz
Posts: 11
Joined: Wed Sep 30, 2009 7:17 am

Re: Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by hoanglz » Tue Oct 06, 2009 3:35 am

hi Alex,

Ranorex Spy can still detect some hidden control in my form (visilbe = false)
Maybe the issue is Toolstrip control itself.
My question is: with toolstrip control:
GetItemCount will return number of Item (visible = true)
or
GetItemCount will return number of Item (visible = true) + (visible = false)
Support Team wrote: In general, that is the default behavior for all technologies. Only visible elements are reported by Ranorex, since these are the only elements a user can interact with.
Best regards,
HoangLX.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Ranorex Spy: Issue with Toolstrip control in .Net 2005

Post by Support Team » Tue Oct 06, 2009 7:31 am

The usage of the visible property depends on the used technologie(MSAA,WinForms,WPF) of the tested control. Some technologies provide information about invisible items and some don't.
My question is: with toolstrip control:
GetItemCount will return number of Item (visible = true)
or
GetItemCount will return number of Item (visible = true) + (visible = false)
In Ranorex.Toolbar class there`s no GetItemCount method.

Children.Count which gives you the count of all items (visible + invisible) as in Ranorex Spy. If you want to get e.g. all underlying Buttons you can use FindDescendands<Ranorex.Button>()

To get all visible buttons use the following RanoreXPath:
IList<Ranorex.Button> visibleButtons = toolStrip.Find<RanorexButton>("button[@visible='true']");
Best regards,
Christian
Ranorex Support Team