Class AppiumBy

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AppiumBy​(java.lang.String selector, java.lang.String locatorString, java.lang.String locatorName)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static org.openqa.selenium.By accessibilityId​(java.lang.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
      static org.openqa.selenium.By androidDataMatcher​(java.lang.String dataMatcherString)
      This locator strategy is only available in Espresso Driver mode.
      static org.openqa.selenium.By androidUIAutomator​(java.lang.String uiautomatorText)
      Refer to https://developer.android.com/training/testing/ui-automator
      static org.openqa.selenium.By androidViewMatcher​(java.lang.String viewMatcherString)
      This locator strategy is only available in Espresso Driver mode.
      static org.openqa.selenium.By androidViewTag​(java.lang.String tag)
      This locator strategy is available in Espresso Driver mode.
      static org.openqa.selenium.By className​(java.lang.String selector)
      For IOS it is the full name of the XCUI element and begins with XCUIElementType.
      static org.openqa.selenium.By custom​(java.lang.String selector)
      This type of locator requires the use of the 'customFindModules' capability and a separately-installed element finding plugin.
      org.openqa.selenium.WebElement findElement​(org.openqa.selenium.SearchContext context)  
      java.util.List<org.openqa.selenium.WebElement> findElements​(org.openqa.selenium.SearchContext context)  
      static org.openqa.selenium.By id​(java.lang.String selector)
      For IOS the element name.
      static org.openqa.selenium.By image​(java.lang.String b64Template)
      This locator strategy is available only if OpenCV libraries and NodeJS bindings are installed on the server machine.
      static org.openqa.selenium.By iOSClassChain​(java.lang.String iOSClassChainString)
      This locator strategy is available in XCUITest Driver mode.
      static org.openqa.selenium.By iOSNsPredicateString​(java.lang.String iOSNsPredicateString)
      This locator strategy is available in XCUITest Driver mode.
      static org.openqa.selenium.By name​(java.lang.String selector)
      For IOS the element name.
      java.lang.String toString()  
      • Methods inherited from class org.openqa.selenium.By

        cssSelector, equals, getJavascriptExecutor, getWebDriver, hashCode, linkText, partialLinkText, tagName, xpath
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.openqa.selenium.By.Remotable

        getRemoteParameters
    • Constructor Detail

      • AppiumBy

        protected AppiumBy​(java.lang.String selector,
                           java.lang.String locatorString,
                           java.lang.String locatorName)
    • Method Detail

      • findElements

        public java.util.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 java.lang.String toString()
        Overrides:
        toString in class org.openqa.selenium.By
      • accessibilityId

        public static org.openqa.selenium.By accessibilityId​(java.lang.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​(java.lang.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​(java.lang.String uiautomatorText)
        Refer to https://developer.android.com/training/testing/ui-automator
        Parameters:
        uiautomatorText - is Android UIAutomator string
        Returns:
        an instance of AppiumBy.ByAndroidUIAutomator
      • androidViewMatcher

        public static org.openqa.selenium.By androidViewMatcher​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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
      • iOSClassChain

        public static org.openqa.selenium.By iOSClassChain​(java.lang.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​(java.lang.String iOSNsPredicateString)
        This locator strategy is available in XCUITest Driver mode.
        Parameters:
        iOSNsPredicateString - is an iOS NsPredicate String
        Returns:
        an instance of AppiumBy.ByIosNsPredicate