Page 1 of 1

Need to get the AccessibleState (and cannot)

Posted: Sat Mar 03, 2012 1:54 am
by carsonw
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!

Re: Need to get the AccessibleState (and cannot)

Posted: Mon Mar 05, 2012 9:26 am
by Support Team
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

Re: Need to get the AccessibleState (and cannot)

Posted: Mon Mar 05, 2012 6:01 pm
by carsonw
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.

Re: Need to get the AccessibleState (and cannot)

Posted: Tue Mar 06, 2012 3:11 pm
by Support Team
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

Re: Need to get the AccessibleState (and cannot)

Posted: Tue Mar 06, 2012 5:33 pm
by carsonw
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.

Re: Need to get the AccessibleState (and cannot)

Posted: Wed Mar 07, 2012 12:27 pm
by Support Team
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
Regards,
Tobias
Ranorex Team

Re: Need to get the AccessibleState (and cannot)

Posted: Wed Mar 07, 2012 6:40 pm
by carsonw
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.