Ranorex

Element attributes differences

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
ranettix



Joined: 28 Aug 2006
Posts: 16

PostPosted: Tue Sep 05, 2006 2:40 pm    Post subject: Element attributes differences
Compared to the .NET C# sourcecode, I found a discrepancy:

C# Source
------------
A status field is defined in C# as System.Windows.Forms.StatusBarPanel.
<status-instance>.Name is a string constant.
The current field value in C# is assigned to <status-instance>.Text.

Ranorex
----------
The current field value is displayed under "Name", with Ranorex Spy.
The is no "Text" attribute, since elements don't have it.
"Role" is set to StaticText.
The current "Name" value as displayed with Ranorex Spy is not accessible
under RanorexNet - it contains the initial value only.
In other words, the current status value cannot be retrieved.

Rolling Eyes
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Sep 05, 2006 8:40 pm    Post subject:
You are right, but I think we cannot do anything at the moment, it seems to be an MSAA problem.
Ranorex uses the newest version of MSAA (Microsoft Active Accessibility Version 2.0).
Here's the Microsoft documentation for StatusBar:

Status Bar Control
...
get_accName
The status bar object itself does not have a Name property. The Name property of each pane in the status bar is the same as the displayed text.
...

See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/ msaapndx_823w.asp

Ranorex uses get_accName to retrieve the Name of a status bar element.
Please let me know, if you know another possibility to get the Name of a status bar element.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
ranettix



Joined: 28 Aug 2006
Posts: 16

PostPosted: Wed Sep 06, 2006 10:01 am    Post subject:
With RanorexNet I can retrieve only the initial value of the statusbar pane
element, in "<element-instance>.Name" (the value returned never changes).

With Ranorex Spy I see the actual contents of the statusbar pane
element, same as displayed in the GUI.

Are there different interfaces used in RanorexNet and Ranorex Spy ?
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Wed Sep 06, 2006 10:33 pm    Post subject:
> Are there different interfaces used in RanorexNet and RanorexSpy ?

No, they both use the same MSAA 2.0 COM objects from C++.

The elements of a control are identified by Role, Name and ClassName in Ranorex.
See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwin forms/html/autowforms.asp
This can make using the element name impossible, if it is dynamically changed.

But you can retrieve the text of a status bar pane as follows:

Code: click into code to enlarge
// Find the control
StatusStrip statusStrip = form.FindStatusStrip("statusStrip1");
...
// Find the status bar element (child) in the control
Element statusBar = statusStrip.Element.FindChild(Role.StatusBar);
if (statusBar != null)
{
    // Get the first pane element
    Element statusBarElement1 = statusBar.GetChild(0);
    if (statusBarElement1 != null)
        Console.WriteLine("Pane1Text={0}", statusBarElement1.Name);
}

Study the output of the DumpElementTree(statusStrip.Element) function in RanorexVS20054Sample3, if you don't understand the code.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
ranettix



Joined: 28 Aug 2006
Posts: 16

PostPosted: Thu Sep 07, 2006 10:49 am    Post subject:
Good tip.
The astonishing experience is that the statusBarElement1 pointer
cannot be used throughout the rest of the program.

It has to be derived from StatusStrip every time it's used again (?).
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Thu Sep 07, 2006 10:54 pm    Post subject:
Yes, you are right, we have a problem with dynamically changed element name of a status bar pane in the version 0.9.2.
You must get the child element every time you need the name.
We will fix this problem in a future version.

Please use the workaround above until that time.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sat Sep 16, 2006 7:14 pm    Post subject:
The problem with dynamically changed element name of a status bar pane has been fixed
(the bug posted at 07 Sep 2006 08:49 am by ranettix).

Use 0.9.4 Beta1 or higher if you have this problem.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum