fill_action method

  1. @override
Future<Online> fill_action(
  1. Online browser,
  2. Map<String, Object> values
)
override

Implementation

@override
Future<Online> fill_action(Online browser, Map<String, Object> values) async {
  for (var field in fields.keys) {
    if (values[field] == null && fields[field]!.mandatory) {
      if (fields[field]!.collect_data == null) {
        //ask for input
        values[field] = await Ask.input("form field", field);
      }
      values[field] = fields[field]!.collect_data!.call(browser);
    }
  }

  for (var field in fields.keys) {
    if (values[field] != null) {
      Show.action("fill", field, values[field].toString());
    }
    await fields[field]!.fill_action(browser, values[field]);
  }

  return browser;
}