Help getting Accessible Value
-
- Posts: 94
- Joined: Tue Jun 16, 2009 10:27 pm
Help getting Accessible Value
Is there a C# sharp method that will enable me to get the Accessible Value of an object into a variable? Thanks
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Help getting Accessible Value
If the element supports the Accessible capability (see following topic in the Ranorex User Guide: http://www.ranorex.com/support/user-gui ... apter.html), then the Accessible.Value property gets you its value:
Alex
Ranorex Support Team
Accessible accElement = repo.MyApp.MyAccessibleElement; string accValue = accElement.Value;Regards,
Alex
Ranorex Support Team
-
- Posts: 94
- Joined: Tue Jun 16, 2009 10:27 pm
Re: Help getting Accessible Value
Thanks Alex,
I tried the following code:
Accessible accElement = repo.FormTacViewC2_map_TacVie.CellTrack_Number_0;
string track1 = accElement.Value;
and I got this error message:
Error CS0029: Cannot implicitly convert type 'Ranorex.Cell' to 'Ranorex.Accessible'
Using Ranorex Spy I am fairly certain this element supports Accessibility. I have attached a screen shot of the Cells properties from Ranorex Spy. Thanks
I tried the following code:
Accessible accElement = repo.FormTacViewC2_map_TacVie.CellTrack_Number_0;
string track1 = accElement.Value;
and I got this error message:
Error CS0029: Cannot implicitly convert type 'Ranorex.Cell' to 'Ranorex.Accessible'
Using Ranorex Spy I am fairly certain this element supports Accessibility. I have attached a screen shot of the Cells properties from Ranorex Spy. Thanks
-
- Posts: 94
- Joined: Tue Jun 16, 2009 10:27 pm
Re: Help getting Accessible Value
Not sure if this the best way to get the value of an Accessible object but this code worked for me:
Ranorex.Accessible cellTrack0 = "/form[@title~'^TacViewC2\\ \\ \\ \\(map:\\ TacView']/element/container/element/table/cell[@accessiblename='Track Number[0]']";
string track1 = cellTrack0.Value;
Where I create an Accessible object, in this case 'cellTrack0' and set it using the RanoreXPath. Then retrieve the value of that object into a variable.
Ranorex.Accessible cellTrack0 = "/form[@title~'^TacViewC2\\ \\ \\ \\(map:\\ TacView']/element/container/element/table/cell[@accessiblename='Track Number[0]']";
string track1 = cellTrack0.Value;
Where I create an Accessible object, in this case 'cellTrack0' and set it using the RanoreXPath. Then retrieve the value of that object into a variable.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Help getting Accessible Value
If your repository item is e.g. a Cell and you want to change the adapter type, you need to create a new adapter of the wanted type:costamesakid wrote:Error CS0029: Cannot implicitly convert type 'Ranorex.Cell' to 'Ranorex.Accessible'
Accessible accElement = new Accessible(repo.FormTacViewC2_map_TacVie.CellTrack_Number_0); string track1 = accElement.Value;You can as well use the technique from your last post, but you should use the above code when you use Ranorex repositories.
Regards,
Alex
Ranorex Support Team