byAncestor static method

String byAncestor({
  1. required String of,
  2. required String matching,
  3. bool matchingRoot = false,
  4. bool firstMatchOnly = false,
})

Returns base64 encoded string as a finder for appium-flutter-driver with the given of, matching and matchingRoot. https://github.com/truongsinh/appium-flutter-driver#finders

Please read https://api.flutter.dev/flutter/flutter_driver/CommonFinders/ancestor.html for more details about each arguments.

var finder = AppiumFlutterFinder.byAncestor(
                 of: AppiumFlutterFinder.byAncestor(
                     of: AppiumFlutterFinder.pageBack(),
                     matching: AppiumFlutterFinder.pageBack(),
                     matchingRoot: false),
                 matching: AppiumFlutterFinder.byAncestor(
                     of: AppiumFlutterFinder.pageBack(),
                     matching: AppiumFlutterFinder.pageBack(),
                     matchingRoot: false),
                 matchingRoot: false,
                 firstMatchOnly: true)
var element = driver.getElement(finder);
await element.click();  // Do actions against the element

Implementation

static String byAncestor(
    {required String of,
    required String matching,
    bool matchingRoot = false,
    bool firstMatchOnly = false}) {
  return AppiumFlutterFinder._byAncestorOrDescendant(
      'Ancestor', of, matching, matchingRoot, firstMatchOnly);
}