Xamarin.UITest Guides | Samples

Xamarin.UITest.IApp.Invoke Method

Invokes a method on the app's main activity for Android and app delegate for iOS. For Xamarin apps, methods must be exposed using attributes as shown below. Android example in activity:

Example

             [Export]
             public string MyInvokeMethod(string arg)
             {
                 return "uitest";
             }
iOS example in app delegate:

Example

             [Export("myInvokeMethod:")]
             public NSString MyInvokeMethod(NSString arg)
             {
                 return new NSString("uitest");
             }

Syntax

public Object Invoke (String methodName, Object argument)

Parameters

methodName
The name of the method to invoke.
argument
The argument to pass to the method.

Returns

The result of the invocation.

Requirements

Namespace: Xamarin.UITest
Assembly: Xamarin.UITest (in Xamarin.UITest.dll)
Assembly Versions: 22.0.0.0