Verify object properties when object is a graphic ChatFx
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
Verify object properties when object is a graphic ChatFx
I'm having a problem to access the properties of an object. The object is a ChartFx. I can only access the information of the control and I need to verify the colors of the background of the graphic.
Can someone help?
Can someone help?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Hello CarlaNeves,
Ranorex 2.0 gets the Chartfx 3rd Party Control elements as a Ranorex.Unknown object.
Create a Ranorex.Control object instead and use the GetProperty() function.
example from the ChartFx Borders and Background Sample Application of the ChartFx 7.0 trial version:
or PlotAreaColor
Regards,
Christian
Ranorex Support Team
Ranorex 2.0 gets the Chartfx 3rd Party Control elements as a Ranorex.Unknown object.
Create a Ranorex.Control object instead and use the GetProperty() function.
example from the ChartFx Borders and Background Sample Application of the ChartFx 7.0 trial version:
Code: Select all
Ranorex.Control elementBordersandBackgrounds = "/form[@controlname='Form1' and @title='Borders and Backgrounds']/element/element[@processname='BordersandBackgrounds' and @controltypename='a']";
System.Drawing.Color color1 = (System.Drawing.Color)elementBordersandBackgrounds.GetPropertyValue("BackColor");
Code: Select all
Ranorex.Unknown elementChart1 = "/form[@controlname='Form1' and @title='Borders and Backgrounds']/element";
System.Drawing.Color color = (System.Drawing.Color)elementChart1.GetPropertyValue("PlotAreaColor");
Christian
Ranorex Support Team
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
Hello,
For those examples and for a few other properties such as width, height or font, the Ranorex is able to get their values, but for many others, for example Gallery I get the following error:
Ranorex.ActionFailedException: Action 'getpropertyvalue' failed on element '{Unknown:bq}'. ---> System.MissingFieldException: Property 'Gallery' not found. at Ranorex.Plugin.WinFormsFlavorElement.GetPropertyValue(String name) at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args) at Ranorex.Core.Element.InvokeAction(String name, Object[] args) --- End of inner exception stack trace --- at Ranorex.Core.Element.InvokeAction(String name, Object[] args) at Ranorex.Control.GetPropertyValue(String name) at Trend.SC02.Start() in c:\RanorexStudio Projects\Trend\Trend\SC02.cs:line 101 at IFX_Trend.Program.Main(String[] args) in c:\RanorexStudio Projects\Trend\Trend\Program.cs:line 67
Can you please help me with this?
For those examples and for a few other properties such as width, height or font, the Ranorex is able to get their values, but for many others, for example Gallery I get the following error:
Ranorex.ActionFailedException: Action 'getpropertyvalue' failed on element '{Unknown:bq}'. ---> System.MissingFieldException: Property 'Gallery' not found. at Ranorex.Plugin.WinFormsFlavorElement.GetPropertyValue(String name) at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args) at Ranorex.Core.Element.InvokeAction(String name, Object[] args) --- End of inner exception stack trace --- at Ranorex.Core.Element.InvokeAction(String name, Object[] args) at Ranorex.Control.GetPropertyValue(String name) at Trend.SC02.Start() in c:\RanorexStudio Projects\Trend\Trend\SC02.cs:line 101 at IFX_Trend.Program.Main(String[] args) in c:\RanorexStudio Projects\Trend\Trend\Program.cs:line 67
Can you please help me with this?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Hello,
it looks like that the property gallerie and maybe other properties of the chartFX7 controls are set to the attribute "[Browsable(false)]".
Use the "Control.InvokeMethod"(via reflection) method instead of "GetPropertyValue" like:
Regards,
Christian
Ranorex Support Team
it looks like that the property gallerie and maybe other properties of the chartFX7 controls are set to the attribute "[Browsable(false)]".
Use the "Control.InvokeMethod"(via reflection) method instead of "GetPropertyValue" like:
Code: Select all
Ranorex.Control elementChart1 = "/form[@controlname='Form1']/element";
object obj = elementChart1.InvokeMethod("get_Gallery");
Gallery gallerie = (Gallery)obj;
Christian
Ranorex Support Team
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
Hi,
I tried to do as you said:
And I got the following compilation errors:
No overload for method 'InvokeMethod' takes '1' arguments (CS1501) - C:\RanorexStudio Projects\Trend\Trend\SC02.cs:101,17.
The type or namespace name 'Gallery' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\RanorexStudio Projects\Trend\Trend\SC02.cs:102,24.
I tried to do as you said:
Code: Select all
Ranorex.Control elementChart1 = "/form[@controlname='FRM_Main']/container/element/*/*/container[@caption='' and @processname='MyApplication' and @controltypename='WindowDockingArea' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='1']/container[@caption='' and @processname='MyApplication' and @controltypename='DockableWindow' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='0']/*/container[@controlname='splitContainerResults']/container[@controlname='panel1']/*/*/element[@controlname='bq']";
object obj = elementChart1.InvokeMethod("get_Gallery");
Gallery gallerie = (Gallery)obj;
No overload for method 'InvokeMethod' takes '1' arguments (CS1501) - C:\RanorexStudio Projects\Trend\Trend\SC02.cs:101,17.
The type or namespace name 'Gallery' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\RanorexStudio Projects\Trend\Trend\SC02.cs:102,24.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
Hi, again...
After several attempts, one follows, I haven't had any luck with the results, I always get a similar error.
The error:
Ranorex.ActionFailedException: Action 'invokemethod' failed on element '{Unknown:bq}'. ---> System.MissingMethodException: Method 'ChartFX.WinForms.al.get_Gallery' not found.] at Ranorex.Plugin.WinFormsFlavorElement.InvokeMethod(BindingFlags flags, String name, Object[] args) at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args) at Ranorex.Core.Element.InvokeAction(String name, Object[] args) --- End of inner exception stack trace --- at Ranorex.Core.Element.InvokeAction(String name, Object[] args) at Ranorex.Control.InvokeMethod(BindingFlags flags, String name, Object[] args) at Ranorex.Control.InvokeMethod(String name) at Trend.SC02.Start() in c:\RanorexStudio Projects\Trend\Trend\SC02.cs:line 106 at Trend.Program.Main(String[] args) in c:\RanorexStudio Projects\Trend\Trend\Program.cs:line 67
Please advise,
Thanks in advance,
Carla Neves
After several attempts, one follows, I haven't had any luck with the results, I always get a similar error.
Code: Select all
Ranorex.Control elementChart1 = "/form[@controlname='FRM_Main']/container/element/*/*/container[@caption='' and @processname='MyApplication' and @controltypename='WindowDockingArea' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='1']/container[@caption='' and @processname='MyApplication' and @controltypename='DockableWindow' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='0']/*/container[@controlname='splitContainerResults']/container[@controlname='panel1']/*/*/element[@controlname='bq']";
object obj = elementChart1.InvokeMethod("get_Gallery");
ChartFX.WinForms.Gallery gallerie = (ChartFX.WinForms.Gallery)obj;
Ranorex.ActionFailedException: Action 'invokemethod' failed on element '{Unknown:bq}'. ---> System.MissingMethodException: Method 'ChartFX.WinForms.al.get_Gallery' not found.] at Ranorex.Plugin.WinFormsFlavorElement.InvokeMethod(BindingFlags flags, String name, Object[] args) at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args) at Ranorex.Core.Element.InvokeAction(String name, Object[] args) --- End of inner exception stack trace --- at Ranorex.Core.Element.InvokeAction(String name, Object[] args) at Ranorex.Control.InvokeMethod(BindingFlags flags, String name, Object[] args) at Ranorex.Control.InvokeMethod(String name) at Trend.SC02.Start() in c:\RanorexStudio Projects\Trend\Trend\SC02.cs:line 106 at Trend.Program.Main(String[] args) in c:\RanorexStudio Projects\Trend\Trend\Program.cs:line 67
Please advise,
Thanks in advance,
Carla Neves
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
It looks like you are using the wrong element. The element you use to call InvokeMethod corresponds to a control of type ChartFX.WinForms.al that obviously does not have a property called "Gallery". As far as I know only the ChartFX.WinForms.Chart class has a "Gallery" property, so you need an element which ControlType attribute is "ChartFX.WinForms.Chart".
Please, try to spy that chart again and search for an element that has a ControlType attribute value of "ChartFX.WinForms.Chart". Then use the path of that element in your code. I assume that the element you currently use is a child of the actual element corresponding to the Chart control.
Regards,
Alex
Ranorex Support Team
Please, try to spy that chart again and search for an element that has a ControlType attribute value of "ChartFX.WinForms.Chart". Then use the path of that element in your code. I assume that the element you currently use is a child of the actual element corresponding to the Chart control.
Regards,
Alex
Ranorex Support Team
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm
Hi,
I'm having a problem, when I run the next piece of code:
The InvokeMethod doesn't fail but the value of obj is always null, the same happens for the properties AxisX, AxisY, AxesX, AxesY, Titles, etc...
Can someone please help me?
Thank you,
Carla Neves
I'm having a problem, when I run the next piece of code:
Code: Select all
Ranorex.Control elementChart1 = "/form[@controlname='FRM_Main']/container/element/*/*/container[@caption='' and @processname='MyApplication' and @controltypename='WindowDockingArea' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='1']/container[@caption='' and @processname='MyApplication' and @controltypename='DockableWindow' and @class='WindowsForms10.Window.8.app.0.bf7771' and @instance='0']/*/container[@controlname='splitContainerResults']/container[@controlname='panel1']/*/element";
object obj = elementChart1.InvokeMethod("get_Panes");
Can someone please help me?
Thank you,
Carla Neves
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
I bet that the types of these properties are not Serializable, i.e. they can't be transferred from one process to the other. There exist workarounds, though, e.g. you can use the InvokeRemotely method to get the relevant data as serializable types.
Please read the following blog that covers the topic on how to transfer unserializable data to and from .NET controls:
http://www.ranorex.com/blog/transfering ... et-control
Another example of the InvokeRemotely method can be found in the following forum post:
http://www.ranorex.com/forum/ranorex-20 ... -t563.html
Regards,
Alex
Ranorex Support Team
Please read the following blog that covers the topic on how to transfer unserializable data to and from .NET controls:
http://www.ranorex.com/blog/transfering ... et-control
Another example of the InvokeRemotely method can be found in the following forum post:
http://www.ranorex.com/forum/ranorex-20 ... -t563.html
Regards,
Alex
Ranorex Support Team
-
- Posts: 14
- Joined: Thu Feb 26, 2009 2:08 pm