| View previous topic :: View next topic |
| Author |
Message |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Thu Nov 16, 2006 4:45 pm Post subject: Calling native methods of an object |
|
| Is it possible to call native methods for custom objects with Ranorex? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Thu Nov 16, 2006 10:11 pm Post subject: |
|
I'm sorry but i don't understand what do you exactly mean.
Can you write a sample please.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Fri Nov 17, 2006 6:40 pm Post subject: |
|
For example,
If I have a custom control with a method DoCustomAction(arg1, arg2) that gets triggered by a mouse click. I want to call that function directly without sending a mouseclick.
My usage would be something like:
Ranorex.ControlShow(hCustomControl);
Ranorex.CallMethod(DoCustomAction, arg1, arg2);
This code would call the DoCustomAction method of the object.
I evaluated Mercury QuickTest Pro and noted thatit is possible to do something similar. I was wondering it was possible to do something like this with Ranorex. I need to do so because I am dealing with a custom combobox that does not obey standard combo box rules. For instance, the function Ranorex.ComboBoxGetItemCount() returns 0 even if the combobox contains items. I wanted to know if I could simply call the object's equivalent of SetComboBoxItem() directly. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sun Nov 19, 2006 11:11 pm Post subject: |
|
If we automate an application with Ranorex, then our testcode runs in an other process.
We don't communicate with the objects of the application directly we use some supported mechanism.
Old windows controls can only be automated with windows messages (SendMessage and PostMessage), newer windows controls can be automated also with Active Accessibility or .NET remoting. But we can only automate a control if it supports a mechanism, we cannot call a function of an object directly from an other process. We can do it only, if we embed Ranorex in the application.
If the custom control cannot be automated with SendMessages (ComboBoxGetItemCount works only with messages at the moment), then you can use the element functions, they use active accessibility (see the sample ElementTest.py). Most of the third party user controls can be automated with the element functions. It is also possible that the control supports some mechanism, please check the documentation.
| tkondal wrote: |
| I evaluated Mercury QuickTest Pro and noted that it is possible to do something similar. |
Please write us what this feature can do, we will implement the functionality for a future release.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
tkondal
Joined: 03 Nov 2006 Posts: 24
|
Posted: Wed Nov 22, 2006 12:26 am Post subject: |
|
Thank you for the reply.
Concering the Mercury QuickTestPro feature that I was mentioning, it allows one to call an object's function by doing something like:
GetCustomComboBox("MyCombo").Object.CustomFunction(arg1, arg2, ...)
e.g.
GetCustomComboBox("MyCombo").Object.set_SelectedItem(arg1, arg2, ...)
I also noticed that with QuictTestPro, it is possible to retrieve all the runtime properties of an object. This allows a user to change a property of a GUI object at runtime. It is most likely done with Reflection. Hope this helps you for implementing a nice feature  |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Wed Nov 22, 2006 9:40 pm Post subject: |
|
Thank you for this suggestion.
| tkondal wrote: |
| with QuictTestPro, it is possible to retrieve all the runtime properties of an object |
We support the same functionality for .NET 2.0 objects in V1.0.0.
| tkondal wrote: |
| Concering the Mercury QuickTestPro feature that I was mentioning, it allows one to call an object's function by doing something like... |
We will analyse the possibilities and we will support a similar functionality in a future version.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Thu Aug 23, 2007 1:07 pm Post subject: |
|
I am very interested in this feature too. When will this be available ?
Can I access a Internal object with the (already existing) handle, or in another with reflection ?
Jörg Abelshauser |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Aug 24, 2007 12:32 am Post subject: |
|
Please write us what do you exactly want to do.
What do you can from an other process, depends on the control type. It's not possible to call an internal function of an MFC control (you can only send messages if you have the control handle), but it's possible to get/set the properties of a .NET Framework control.
We use this feature in RanorexSpyPro, but we support it only for the .NET languages at the moment.
Please check your controls with RanorexSpy, you can solve most of the problems with the element class.
Jenö
Ranorex Team |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Fri Aug 24, 2007 9:01 am Post subject: |
|
I want to access public members in a C#-Form-class, e.g.:
public class Form1 : System.Windows.Forms.Form
{
public static string bla = "boing";
Is there a way to access the Instance of the class Form1 via the Ranorex-Form, so i can access e.g. the static string bla ? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Aug 24, 2007 9:48 pm Post subject: |
|
We implemented the possibility that you can get and set the public properties of a .NET control from an other process.
RanorexSpyPro uses this mechanism, but V1.2 supports only the properties of the standard controls and it works only in C#.
| Quote: |
| ... so i can access e.g. the static string bla |
You can access only public properties at the moment, but we will check the possibilities.
Jenö
Ranorex Team |
|
| Back to top |
|
 |
|