enterText method

Future<void> enterText(
  1. NativeSelector selector, {
  2. required String text,
  3. String? appId,
  4. KeyboardBehavior? keyboardBehavior,
  5. Duration? timeout,
  6. Offset? tapLocation,
})

Enters text to the native view specified by selector.

If the text field isn't immediately visible, this method waits for the view to become visible. It prioritizes the timeout duration provided in the method call. If timeout is not specified, it utilizes the NativeAutomatorConfig.findTimeout duration from the configuration.

The native view specified by selector must be:

  • EditText or AutoCompleteTextView on Android
  • TextField or SecureTextField on iOS

See also:

Implementation

Future<void> enterText(
  NativeSelector selector, {
  required String text,
  String? appId,
  KeyboardBehavior? keyboardBehavior,
  Duration? timeout,
  Offset? tapLocation,
}) => _platform.action.mobile(
  android: () => _platform.android.enterText(
    _getSafeAndroidSelector(selector),
    text: text,
    keyboardBehavior: keyboardBehavior,
    timeout: timeout,
    tapLocation: tapLocation,
  ),
  ios: () => _platform.ios.enterText(
    _getSafeIOSSelector(selector),
    text: text,
    appId: appId,
    keyboardBehavior: keyboardBehavior,
    timeout: timeout,
    tapLocation: tapLocation,
  ),
);