Xamarin.UITest Guides | Samples

Xamarin.UITest.IApp: Method Members

The methods of Xamarin.UITest.IApp are listed below. For a list of all members, see the IApp list.

Public Methods

Back()
Navigate back on the device.
ClearText()
Clears text from the currently focused element.
ClearText(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>)
Clears text from a matching element that supports it.
ClearText(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>)
Clears text from a matching element that supports it.
ClearText(String)
Clears text from a matching element that supports it.
DismissKeyboard()
Hides keyboard if present
DoubleTap(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>)
Performs two quick tap / touch gestures on the matched element. If multiple elements are matched, the first one will be used.
DoubleTap(String)
Performs two quick tap / touch gestures on the matched element. If multiple elements are matched, the first one will be used.
DoubleTapCoordinates(Single, Single)
Performs a quick double tap / touch gesture on the given coordinates.
DragAndDrop(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>)
Drags the from element to the to element.
DragAndDrop(String, String)
Drags the from element to the to element.
DragCoordinates(Single, Single, Single, Single)
Performs a continuous drag gesture between 2 points.
EnterText(String)
Enters text into the currently focused element.
EnterText(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, String)
Enters text into a matching element that supports it.
EnterText(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, String)
Enters text into a matching element that supports it.
EnterText(String, String)
Enters text into a matching element that supports it.
Flash(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>) : AppResult[]
Highlights the results of the query by making them flash. Specify view elements using the fluent API. Defaults to all view objects that are visible.
Flash(String) : AppResult[]
Highlights the results of the query by making them flash. Specify view elements using marked string.
Invoke(String, Object) : Object
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");
             }
Invoke(String, Object[]) : Object
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, string arg2)
             {
                 return "uitest";
             }
iOS example in app delegate:

Example

             [Export("myInvokeMethod:")]
             public NSString MyInvokeMethod(NSString arg, NSString arg2)
             {
                 return new NSString("uitest");
             }
PinchToZoomIn(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Nullable<TimeSpan>)
Performs a pinch gestures on the matched element to zoom the view in. If multiple elements are matched, the first one will be used.
PinchToZoomIn(String, Nullable<TimeSpan>)
Performs a pinch gestures on the matched element to zoom the view in. If multiple elements are matched, the first one will be used.
PinchToZoomInCoordinates(Single, Single, Nullable<TimeSpan>)
Performs a pinch gestures to zoom the view in on the given coordinates.
PinchToZoomOut(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Nullable<TimeSpan>)
Performs a pinch gestures on the matched element to zoom the view out. If multiple elements are matched, the first one will be used.
PinchToZoomOut(String, Nullable<TimeSpan>)
Performs a pinch gestures on the matched element to zoom the view out. If multiple elements are matched, the first one will be used.
PinchToZoomOutCoordinates(Single, Single, Nullable<TimeSpan>)
Performs a pinch gestures to zoom the view in on the given coordinates.
PressEnter()
Presses the enter key in the app.
PressVolumeDown()
Presses the volume down button on the device.
PressVolumeUp()
Presses the volume up button on the device.
Query(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>) : AppResult[]
Queries view objects using the fluent API. Defaults to only return view objects that are visible.
Query(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>) : AppWebResult[]
Queries web view objects using the fluent API. Defaults to only return view objects that are visible.
Query(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.InvokeJSAppQuery>) : String[]
Invokes Javascript on view objects using the fluent API.
Query(String) : AppResult[]
Queries view objects using the fluent API. Defaults to only return view objects that are visible.
Query<T>(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppTypedSelector<T>>) : T[]
Queries properties on view objects using the fluent API.
Repl()
Starts an interactive REPL (Read-Eval-Print-Loop) for app exploration and pauses test execution until it is closed.
Screenshot(String) : FileInfo
Takes a screenshot of the app in it's current state. This is used to denote test steps in the Xamarin Test Cloud.
ScrollDown(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean)
Scrolls down on the first element matching query.
ScrollDown(String, ScrollStrategy, Double, Int32, Boolean)
Scrolls down on the first element matching query.
ScrollDownTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll down until an element that matches the toQuery is shown on the screen.
ScrollDownTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll down until an element that matches the toQuery is shown on the screen.
ScrollDownTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, String, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll down until an element that matches the toMarked is shown on the screen.
ScrollDownTo(String, String, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll down until an element that matches the toMarked is shown on the screen.
ScrollTo(String, String, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll until an element that matches the toMarked is shown on the screen.
ScrollUp(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean)
Scrolls up on the first element matching query.
ScrollUp(String, ScrollStrategy, Double, Int32, Boolean)
Scrolls up on the first element matching query.
ScrollUpTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll up until an element that matches the toQuery is shown on the screen.
ScrollUpTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll up until an element that matches the toQuery is shown on the screen.
ScrollUpTo(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, String, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll up until an element that matches the toMarked is shown on the screen.
ScrollUpTo(String, String, ScrollStrategy, Double, Int32, Boolean, Nullable<TimeSpan>)
Scroll up until an element that matches the toMarked is shown on the screen.
SetOrientationLandscape()
Changes the device (iOS) or current activity (Android) orientation to landscape mode.
SetOrientationPortrait()
Changes the device (iOS) or current activity (Android) orientation to portrait mode.
SetSliderValue(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Double)
Sets the value of a slider element that matches query.
SetSliderValue(String, Double)
Sets the value of a slider element that matches marked.
SwipeLeft()
Performs a right to left swipe gesture.
SwipeLeftToRight(Double, Int32, Boolean)
Performs a left to right swipe gesture.
SwipeLeftToRight(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Double, Int32, Boolean)
Performs a left to right swipe gesture on an element matched by 'query'.
SwipeLeftToRight(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, Double, Int32, Boolean)
Performs a left to right swipe gesture on an element matched by 'query'.
SwipeLeftToRight(String, Double, Int32, Boolean)
Performs a left to right swipe gesture on the matching element. If multiple elements are matched, the first one will be used.
SwipeRight()
Performs a left to right swipe gesture.
SwipeRightToLeft(Double, Int32, Boolean)
Performs a right to left swipe gesture.
SwipeRightToLeft(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, Double, Int32, Boolean)
Performs a right to left swipe gesture on an element matched by 'query'.
SwipeRightToLeft(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, Double, Int32, Boolean)
Performs a right to left swipe gesture on an element matched by 'query'.
SwipeRightToLeft(String, Double, Int32, Boolean)
Performs a right to left swipe gesture on the matching element. If multiple elements are matched, the first one will be used.
Tap(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>)
Performs a tap / touch gesture on the matched element. If multiple elements are matched, the first one will be used.
Tap(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>)
Performs a tap / touch gesture on the matched element. If multiple elements are matched, the first one will be used.
Tap(String)
Performs a tap / touch gesture on the matched element. If multiple elements are matched, the first one will be used.
TapCoordinates(Single, Single)
Performs a tap / touch gesture on the given coordinates.
TouchAndHold(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>)
Performs a continuous touch gesture on the matched element. If multiple elements are matched, the first one will be used.
TouchAndHold(String)
Performs a continuous touch gesture on the matched element. If multiple elements are matched, the first one will be used.
TouchAndHoldCoordinates(Single, Single)
Performs a continuous touch gesture on the given coordinates.
WaitFor(Func<bool>, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>)
Generic wait function that will repeatly call the predicate function until it returns true. Throws a TimeoutException if the predicate is not fullfilled within the time limit.
WaitForElement(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>) : AppResult[]
Wait function that will repeatly query the app until a matching element is found. Throws a TimeoutException if no element is found within the time limit.
WaitForElement(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>) : AppWebResult[]
Wait function that will repeatly query the app until a matching element is found. Throws a TimeoutException if no element is found within the time limit.
WaitForElement(String, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>) : AppResult[]
Wait function that will repeatly query the app until a matching element is found. Throws a TimeoutException if no element is found within the time limit.
WaitForNoElement(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppQuery>, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>)
Wait function that will repeatly query the app until a matching element is no longer found. Throws a TimeoutException if the element is visible at the end of the time limit.
WaitForNoElement(Func<Xamarin.UITest.Queries.AppQuery, Xamarin.UITest.Queries.AppWebQuery>, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>)
Wait function that will repeatly query the app until a matching element is no longer found. Throws a TimeoutException if the element is visible at the end of the time limit.
WaitForNoElement(String, String, Nullable<TimeSpan>, Nullable<TimeSpan>, Nullable<TimeSpan>)
Wait function that will repeatly query the app until a matching element is no longer found. Throws a TimeoutException if the element is visible at the end of the time limit.