Package io.appium.java_client
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.ByImage
,AppiumBy.ByIosClassChain
,AppiumBy.ByIosNsPredicate
,MobileBy
public abstract class AppiumBy extends org.openqa.selenium.By implements org.openqa.selenium.By.Remotable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AppiumBy.ByAccessibilityId
static class
AppiumBy.ByAndroidDataMatcher
static class
AppiumBy.ByAndroidUIAutomator
static class
AppiumBy.ByAndroidViewMatcher
static class
AppiumBy.ByAndroidViewTag
static class
AppiumBy.ByClassName
static class
AppiumBy.ByCustom
static class
AppiumBy.ByImage
static class
AppiumBy.ByIosClassChain
static class
AppiumBy.ByIosNsPredicate
-
Nested classes/interfaces inherited from class org.openqa.selenium.By
org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath, org.openqa.selenium.By.Remotable
-
-
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.htmlstatic 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-automatorstatic 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
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.java.lang.String
toString()
-
Methods inherited from class org.openqa.selenium.By
cssSelector, equals, getJavascriptExecutor, getWebDriver, hashCode, id, linkText, name, partialLinkText, tagName, xpath
-
-
-
-
Method Detail
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context)
- Specified by:
findElements
in classorg.openqa.selenium.By
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.SearchContext context)
- Overrides:
findElement
in classorg.openqa.selenium.By
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.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
-
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
-
image
public 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.- 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:
- The documentation on Image Comparison Features, The settings available for lookup fine-tuning
-
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
-
-