AccessibleDefaultAction isn't working : Automation Tools

AccessibleDefaultAction isn't working

Ranorex Spy, Recorder, and Studio.

AccessibleDefaultAction isn't working

Postby itmbr » Wed Jan 19, 2011 4:34 pm

Hi there,

In the program I have to test I want to Expand (or Collapse) the container, for example "Zentraler Eingriff" with Ranorex.

I've tried to get to it in the program code

Ranorex.Container tabButtonTree = "/adfgdasfg" (the Ranorex-Path)
//Expand the chosen Container
string strDefaultAction = tabButtonTree.Element.GetAttributeValue("AccessibleDefaultAction").ToString();
tabButtonTree.Element.InvokeAction("strDefaultAction");

but, I don't know why, the access to the AccessibleDefaultAction (which would be "Expand" if the container is closed and in the other way if it is opened) is denied.

So I built a workaround with an easy Click()-Event instead of the code I told before, but it isn't really satisfying.

Maybe you know another possibility to solve this problem? Or is this the only way to Expand/Collapse a Container?

Best Regards
Attachments
central2.rxsnp
(8.64 KiB) Downloaded 13 times
central.rxsnp
(2.2 KiB) Downloaded 16 times
itmbr
 
Posts: 5
Joined: Mon Oct 11, 2010 10:58 am

Re: AccessibleDefaultAction isn't working

Postby Support Team » Wed Jan 19, 2011 10:01 pm

In
tabButtonTree.Element.InvokeAction("strDefaultAction")
you have quote signs around strDefaultAction.
If that's not the reason, please come back.

Regards, Roland
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: AccessibleDefaultAction isn't working

Postby Support Team » Wed Jan 19, 2011 10:59 pm

To invoke the default action you should just do:

Accessible acc = tabButtonTree.Element;
acc.DoDefaultAction();

Regards, Roland
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: AccessibleDefaultAction isn't working

Postby itmbr » Thu Jan 20, 2011 3:58 pm

Hi,

thank you for your answer. I tried your last suggestion in my Code, but at first i could not find an Object called 'Accessible', only 'AccessibleObject'. With that I got the error

'Cannot implicitly convert type 'Ranorex.Core.Element' to 'System.Windows.Forms.AccessibleObject'.

So, where can I find the 'Accessible'-Object?

Best Regards
itmbr
 
Posts: 5
Joined: Mon Oct 11, 2010 10:58 am

Re: AccessibleDefaultAction isn't working

Postby Support Team » Thu Jan 20, 2011 4:27 pm

itmbr wrote:I tried your last suggestion in my Code, but at first i could not find an Object called 'Accessible', only 'AccessibleObject'. With that I got the error

If you do not have a "using Ranorex;" statement at the beginning of your code file, you have to specify the full name "Ranorex.Accessible" for that class. The "using" statement should be there if you use the Ranorex Studio code templates.

Regards,
Alex
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: AccessibleDefaultAction isn't working

Postby itmbr » Fri Jan 21, 2011 1:38 pm

Although I have an "using Ranorex;"-statement in my Code, I have no "Ranorex.Accessible".

So, I get with tabButtonTree.MoveTo() close to the container. So I want to get with the mouse exactly to the container. I saw there is an "Mouse.Position.X"-property, but if i do the command

Mouse.Position.X += 5;

i get an error "Cannot modify the return value of 'Ranorex.Mouse.Position' because it is not a variable". Of course, it's an object, but i have to get on this X and Y-values. Do you have an idea?

Thanks for the answers and regards
itmbr
 
Posts: 5
Joined: Mon Oct 11, 2010 10:58 am

Re: AccessibleDefaultAction isn't working

Postby Support Team » Fri Jan 21, 2011 1:51 pm

itmbr wrote:Although I have an "using Ranorex;"-statement in my Code, I have no "Ranorex.Accessible".

It looks like you did not use the default Ranorex template for creating your project. You have to add references to all Ranorex plugin to your project. See following section in the Ranorex User Guide:
http://www.ranorex.com/support/user-gui ... rence.html

itmbr wrote:Mouse.Position.X += 5;

The correct syntax is the following:
Mouse.Position += new Size(0, 5);

However, it is much easier to specify a relative location in the MoveTo method, e.g.:
tabButtonTree.MoveTo("15;20")

Regards,
Alex
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation Tools

Who is online

Users browsing this forum: No registered users and 0 guests