Need to get the AccessibleState (and cannot)

Ranorex Spy, Recorder, and Studio.
carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Need to get the AccessibleState (and cannot)

Post by carsonw » Sat Mar 03, 2012 1:54 am

I need to be able to retrieve the accessible state of Ranorex.Text Object.

I tried getting it using a method similar to what was described in another post:

Code: Select all

Ranorex.Accessible accField = new Accessible(field.GetWUTextField().Element);
System.Windows.Forms.AccessibleStates state = accField.State;
...but I get the following error:

The element does not support the required capability 'accessible'.

Yet, in the attached screenshot, you can see that the AccessibleState is there (taunting me!), so Ranorex is able to see it somehow.

Is there some way to retrieve these values that I'm missing? Thanks!
Attachments
appstate.jpg
appstate.jpg (276.43 KiB) Viewed 1234 times

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

Re: Need to get the AccessibleState (and cannot)

Post by Support Team » Mon Mar 05, 2012 9:26 am

Hi,

are you sure that the given method does return the right control?
As basically, the code you've written should work.

Regards,
Tobias
Support Team
.
Image

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Need to get the AccessibleState (and cannot)

Post by carsonw » Mon Mar 05, 2012 6:01 pm

Yes, I had thought the same thing. But I accessed the object through the repository directly, and still it did not work.

So I tried getting the Element like this as well:

Code: Select all

WUSppAdminApp.WUGetRepository().WUFormCustomerDetails.CreditSettings.TextSpotTransactionsLimit.Element;


Which did not work. Do I need to use the "info" version? I couldn't find an element property in that one:

Code: Select all

WUSppAdminApp.WUGetRepository().WUFormCustomerDetails.CreditSettings.TextSpotTransactionsLimitInfo
We have a number of tests that check whether or not a field is writeable and right now we can't use any of them. I tried looking through the attributes as well, but I didn't see anything in there that would help me.

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

Re: Need to get the AccessibleState (and cannot)

Post by Support Team » Tue Mar 06, 2012 3:11 pm

Hi,

Would it be possible sending us a Ranorex Snapshot file of your application under test and the specific RxPath to the used elements, or even better a small sample app with such a control?
Following link will show you how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html
With these snapshot files we can have a closer look on the controls and on the available attributes of these controls.
Do you have tried converting the element to an Accessible adapter with the As method:
Accessible acc = yourRepository.YourElement.Element.As<Accessible>();
String str =  acc.State.ToString();
Regards,
Markus
Ranorex Support Team
.
Image

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Need to get the AccessibleState (and cannot)

Post by carsonw » Tue Mar 06, 2012 5:33 pm

Using the new code suggestion no longer throws an exception, but instead the accessible comes back null.

Here's a screenshot with the null item and the repository object in the watch, and a mouseover of the element (to show it's there).

In the meantime, I've e-mail support the snapshot referencing this post. Thanks :)

Carson.
Attachments
NullState.jpg
NullState.jpg (219.3 KiB) Viewed 1206 times

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

Re: Need to get the AccessibleState (and cannot)

Post by Support Team » Wed Mar 07, 2012 12:27 pm

Hi,

for me it looks like you are working on the wrong control.
You're trying to convert "text[@controlname='UnsettledTransactionsLimitTextBox']" (framed red) to accessible but you have to convert the nested "text[@accessiblename='Spot transactions:']" (framed green).
repo.png
Ranorex Spy
repo.png (6.54 KiB) Viewed 1200 times
Regards,
Tobias
Ranorex Team
.
Image

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Need to get the AccessibleState (and cannot)

Post by carsonw » Wed Mar 07, 2012 6:40 pm

You got it! That was it, thank you!

I recall when adding items to our repository that there are two - the text box, then the text within and I didn't know which to use.

I ended up using the textbox itself, which worked for the purposes of setting / getting the text - but it looks like the actual text inside is needed for additional functionality.

Thanks very much for your help! :)

Carson.