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
AccessibleDefaultAction isn't working
AccessibleDefaultAction isn't working
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: AccessibleDefaultAction isn't working
In
tabButtonTree.Element.InvokeAction("strDefaultAction")
you have quote signs around strDefaultAction.
If that's not the reason, please come back.
Regards, Roland
tabButtonTree.Element.InvokeAction("strDefaultAction")
you have quote signs around strDefaultAction.
If that's not the reason, please come back.
Regards, Roland
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: AccessibleDefaultAction isn't working
To invoke the default action you should just do:
Accessible acc = tabButtonTree.Element;
acc.DoDefaultAction();
Regards, Roland
Accessible acc = tabButtonTree.Element;
acc.DoDefaultAction();
Regards, Roland
Re: AccessibleDefaultAction isn't working
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
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: AccessibleDefaultAction isn't working
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.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
Regards,
Alex
Ranorex Team
Re: AccessibleDefaultAction isn't working
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
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: AccessibleDefaultAction isn't working
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:itmbr wrote:Although I have an "using Ranorex;"-statement in my Code, I have no "Ranorex.Accessible".
http://www.ranorex.com/support/user-gui ... rence.html
The correct syntax is the following:itmbr wrote:Mouse.Position.X += 5;
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