How to use InvokeRemotely on Element

Class library usage, coding and language questions.
Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

How to use InvokeRemotely on Element

Post by Marianne Jacobsen » Mon Nov 30, 2009 2:32 pm

Do I need to use Elment.As<Control>() before I can use invokeremotely? I can see the GetPropertyValue, SetPropertyValue and InvokeRemotely on my element (in the Actions list) - so is a cast necessary?


User avatar
Support Team
Site Admin
Site Admin
Posts: 12169
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: How to use InvokeRemotely on Element

Post by Support Team » Mon Nov 30, 2009 4:44 pm

A cast is not necessary, if you invoke the actions using the Element.InvokeAction method. However, if you cast the element to a Ranorex.Control, you have typed methods for the corresponding actions, e.g. an InvokeRemotely method with all the arguments that are needed and the right type of arguments.

So, if you use the Ranorex.Control class, the code completion and the compiler will help you and check that you are using the right type of arguments. If you don't cast to Control, but use the Element.InvokeAction method instead, you need to make sure yourself that you use the right action name and the right arguments. Additionally, the cast will check if the element supports the Control capability and the actions related to that capability (e.g. InvokeRemotely).

Ranorex Support Team