Class AppiumBy

java.lang.Object
org.openqa.selenium.By
io.appium.java_client.AppiumBy
All Implemented Interfaces:
org.openqa.selenium.By.Remotable
Direct Known Subclasses:
AppiumBy.ByAccessibilityId, AppiumBy.ByAndroidDataMatcher, AppiumBy.ByAndroidUIAutomator, AppiumBy.ByAndroidViewMatcher, AppiumBy.ByAndroidViewTag, AppiumBy.ByClassName, AppiumBy.ByCustom, AppiumBy.ById, AppiumBy.ByImage, AppiumBy.ByIosClassChain, AppiumBy.ByIosNsPredicate, AppiumBy.ByName, AppiumBy.FlutterBy

public abstract class AppiumBy extends org.openqa.selenium.By implements org.openqa.selenium.By.Remotable
  • Constructor Details

    • AppiumBy

      protected AppiumBy(String selector, String locatorString, String locatorName)
  • Method Details

    • findElements

      public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context)
      Specified by:
      findElements in class org.openqa.selenium.By
    • findElement

      public org.openqa.selenium.WebElement findElement(org.openqa.selenium.SearchContext context)
      Overrides:
      findElement in class org.openqa.selenium.By
    • toString

      public String toString()
      Overrides:
      toString in class org.openqa.selenium.By
    • accessibilityId

      public static org.openqa.selenium.By accessibilityId(String accessibilityId)
      About Android accessibility https://developer.android.com/intl/ru/training/accessibility/accessible-app.html About iOS accessibility https://developer.apple.com/library/ios/documentation/UIKit/Reference/ UIAccessibilityIdentification_Protocol/index.html
      Parameters:
      accessibilityId - id is a convenient UI automation accessibility Id.
      Returns:
      an instance of AppiumBy.ByAndroidUIAutomator
    • androidDataMatcher

      public static org.openqa.selenium.By androidDataMatcher(String dataMatcherString)
      This locator strategy is only available in Espresso Driver mode.
      Parameters:
      dataMatcherString - is a valid json string detailing hamcrest matcher for Espresso onData(). See the documentation for more details
      Returns:
      an instance of AppiumBy.ByAndroidDataMatcher
    • androidUIAutomator

      public static org.openqa.selenium.By androidUIAutomator(String uiautomatorText)
      Refer to UI Automator .
      Parameters:
      uiautomatorText - is Android UIAutomator string
      Returns:
      an instance of AppiumBy.ByAndroidUIAutomator
    • androidViewMatcher

      public static org.openqa.selenium.By androidViewMatcher(String viewMatcherString)
      This locator strategy is only available in Espresso Driver mode.
      Parameters:
      viewMatcherString - is a valid json string detailing hamcrest matcher for Espresso onView(). See the documentation for more details
      Returns:
      an instance of AppiumBy.ByAndroidViewMatcher
    • androidViewTag

      public static org.openqa.selenium.By androidViewTag(String tag)
      This locator strategy is available in Espresso Driver mode.
      Parameters:
      tag - is a view tag string
      Returns:
      an instance of AppiumBy.ByAndroidViewTag
      Since:
      Appium 1.8.2 beta
    • className

      public static org.openqa.selenium.By className(String selector)
      For IOS it is the full name of the XCUI element and begins with XCUIElementType. For Android it is the full name of the UIAutomator2 class (e.g.: android.widget.TextView)
      Parameters:
      selector - the class name of the element
      Returns:
      an instance of AppiumBy.ByClassName
    • id

      public static org.openqa.selenium.By id(String selector)
      For IOS the element name. For Android it is the resource identifier.
      Parameters:
      selector - element id
      Returns:
      an instance of AppiumBy.ById
    • name

      public static org.openqa.selenium.By name(String selector)
      For IOS the element name. For Android it is the resource identifier.
      Parameters:
      selector - element id
      Returns:
      an instance of AppiumBy.ByName
    • custom

      public static org.openqa.selenium.By custom(String selector)
      This type of locator requires the use of the 'customFindModules' capability and a separately-installed element finding plugin.
      Parameters:
      selector - selector to pass to the custom element finding plugin
      Returns:
      an instance of AppiumBy.ByCustom
      Since:
      Appium 1.9.2
    • image

      public static org.openqa.selenium.By image(String b64Template)
      This locator strategy is available only if OpenCV libraries and Node.js bindings are installed on the server machine.
      Parameters:
      b64Template - base64-encoded template image string. Supported image formats are the same as for OpenCV library.
      Returns:
      an instance of AppiumBy.ByImage
      Since:
      Appium 1.8.2
      See Also:
    • iOSClassChain

      public static org.openqa.selenium.By iOSClassChain(String iOSClassChainString)
      This locator strategy is available in XCUITest Driver mode.
      Parameters:
      iOSClassChainString - is a valid class chain locator string. See the documentation for more details
      Returns:
      an instance of AppiumBy.ByIosClassChain
    • iOSNsPredicateString

      public static org.openqa.selenium.By iOSNsPredicateString(String iOSNsPredicateString)
      This locator strategy is available in XCUITest Driver mode.
      Parameters:
      iOSNsPredicateString - is an iOS NsPredicate String
      Returns:
      an instance of AppiumBy.ByIosNsPredicate
    • flutterKey

      public static AppiumBy.FlutterBy flutterKey(String selector)
      This locator strategy is available in FlutterIntegration Driver mode.
      Parameters:
      selector - is the value defined to the key attribute of the flutter element
      Returns:
      an instance of AppiumBy.ByFlutterKey
    • flutterType

      public static AppiumBy.FlutterBy flutterType(String selector)
      This locator strategy is available in FlutterIntegration Driver mode.
      Parameters:
      selector - is the Type of widget mounted in the app tree
      Returns:
      an instance of AppiumBy.ByFlutterType
    • flutterText

      public static AppiumBy.FlutterBy flutterText(String selector)
      This locator strategy is available in FlutterIntegration Driver mode.
      Parameters:
      selector - is the text that is present on the widget
      Returns:
      an instance of AppiumBy.ByFlutterText
    • flutterTextContaining

      public static AppiumBy.FlutterBy flutterTextContaining(String selector)
      This locator strategy is available in FlutterIntegration Driver mode.
      Parameters:
      selector - is the text that is partially present on the widget
      Returns:
      an instance of AppiumBy.ByFlutterTextContaining
    • flutterSemanticsLabel

      public static AppiumBy.FlutterBy flutterSemanticsLabel(String semanticsLabel)
      This locator strategy is available in FlutterIntegration Driver mode.
      Parameters:
      semanticsLabel - represents the value assigned to the label attribute of semantics element
      Returns:
      an instance of AppiumBy.ByFlutterSemanticsLabel
    • flutterDescendant

      public static AppiumBy.FlutterBy flutterDescendant(AppiumBy.FlutterBy of, AppiumBy.FlutterBy matching, boolean matchRoot, boolean skipOffstage)
      This locator strategy is available in FlutterIntegration Driver mode since version 1.4.0.
      Parameters:
      of - represents the parent widget locator
      matching - represents the descendant widget locator to match
      matchRoot - determines whether to include the root widget in the search
      skipOffstage - determines whether to skip offstage widgets
      Returns:
      an instance of AppiumBy.ByFlutterDescendant
    • flutterDescendant

      public static AppiumBy.FlutterBy flutterDescendant(AppiumBy.FlutterBy of, AppiumBy.FlutterBy matching)
      This locator strategy is available in FlutterIntegration Driver mode since version 1.4.0.
      Parameters:
      of - represents the parent widget locator
      matching - represents the descendant widget locator to match
      Returns:
      an instance of AppiumBy.ByFlutterDescendant
    • flutterAncestor

      public static AppiumBy.FlutterBy flutterAncestor(AppiumBy.FlutterBy of, AppiumBy.FlutterBy matching, boolean matchRoot)
      This locator strategy is available in FlutterIntegration Driver mode since version 1.4.0.
      Parameters:
      of - represents the child widget locator
      matching - represents the ancestor widget locator to match
      matchRoot - determines whether to include the root widget in the search
      Returns:
      an instance of AppiumBy.ByFlutterAncestor
    • flutterAncestor

      public static AppiumBy.FlutterBy flutterAncestor(AppiumBy.FlutterBy of, AppiumBy.FlutterBy matching)
      This locator strategy is available in FlutterIntegration Driver mode since version 1.4.0.
      Parameters:
      of - represents the child widget locator
      matching - represents the ancestor widget locator to match
      Returns:
      an instance of AppiumBy.ByFlutterAncestor