|
| 1 | +package pro.truongsinh.appium_flutter |
| 2 | + |
| 3 | +import io.appium.java_client.MobileElement |
| 4 | +import org.openqa.selenium.remote.RemoteWebDriver |
| 5 | +import pro.truongsinh.appium_flutter.finder.FlutterElement |
| 6 | +import pro.truongsinh.appium_flutter.finder.ancestor as _ancestor |
| 7 | +import pro.truongsinh.appium_flutter.finder.bySemanticsLabel as _bySemanticsLabel |
| 8 | +import pro.truongsinh.appium_flutter.finder.byTooltip as _byTooltip |
| 9 | +import pro.truongsinh.appium_flutter.finder.byType as _byType |
| 10 | +import pro.truongsinh.appium_flutter.finder.byValueKey as _byValueKey |
| 11 | +import pro.truongsinh.appium_flutter.finder.descendant as _descendant |
| 12 | +import pro.truongsinh.appium_flutter.finder.pageback as _pageback |
| 13 | +import pro.truongsinh.appium_flutter.finder.text as _text |
| 14 | + |
| 15 | + |
| 16 | +public class FlutterFinder(driver: RemoteWebDriver) { |
| 17 | + private val driver = driver |
| 18 | + fun ancestor(of: FlutterElement, matching: FlutterElement, matchRoot: Boolean = false): FlutterElement { |
| 19 | + val f = _ancestor(of, matching, matchRoot) |
| 20 | + f.setParent(driver) |
| 21 | + return f |
| 22 | + } |
| 23 | + fun bySemanticsLabel(label: String): FlutterElement { |
| 24 | + val f = _bySemanticsLabel(label) |
| 25 | + f.setParent(driver) |
| 26 | + return f |
| 27 | + } |
| 28 | + fun bySemanticsLabel(label: Regex): FlutterElement { |
| 29 | + val f = _bySemanticsLabel(label) |
| 30 | + f.setParent(driver) |
| 31 | + return f |
| 32 | + } |
| 33 | + fun byTooltip(input: String): FlutterElement { |
| 34 | + val f = _byTooltip(input) |
| 35 | + f.setParent(driver) |
| 36 | + return f |
| 37 | + } |
| 38 | + fun byType(input: String): FlutterElement { |
| 39 | + val f = _byType(input) |
| 40 | + f.setParent(driver) |
| 41 | + return f |
| 42 | + } |
| 43 | + fun byValueKey(input: String): FlutterElement { |
| 44 | + val f = _byValueKey(input) |
| 45 | + f.setParent(driver) |
| 46 | + return f |
| 47 | + } |
| 48 | + fun byValueKey(input: Int): FlutterElement { |
| 49 | + val f = _byValueKey(input) |
| 50 | + f.setParent(driver) |
| 51 | + return f |
| 52 | + } |
| 53 | + fun descendant(of: FlutterElement, matching: FlutterElement, matchRoot: Boolean = false): FlutterElement { |
| 54 | + val f = _descendant(of, matching, matchRoot) |
| 55 | + f.setParent(driver) |
| 56 | + return f |
| 57 | + } |
| 58 | + fun pageback(): FlutterElement { |
| 59 | + val f = _pageback() |
| 60 | + f.setParent(driver) |
| 61 | + return f |
| 62 | + } |
| 63 | + fun text(input: String): FlutterElement { |
| 64 | + val f = _text(input) |
| 65 | + f.setParent(driver) |
| 66 | + return f |
| 67 | + } |
| 68 | +} |
0 commit comments