-
- -
-

webdriver.extensions.search_context package

-
-

Submodules

-
-
-

webdriver.extensions.search_context.android module

-
-
-class AndroidSearchContext(*args, **kwargs)
-

Bases: appium.protocols.webdriver.can_find_elements.CanFindElements

-

Define search context for Android

-
-
-find_element_by_android_data_matcher(name: Optional[str] = None, args: Optional[Any] = None, className: Optional[str] = None) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.ANDROID_DATA_MATCHER’ instead.

-
-
-

Finds element by -[onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android

-

It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).

-
-
Parameters
-
    -
  • name – The name of a method to invoke. -The method must return a Hamcrest -[Matcher](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)

  • -
  • args – The args provided to the method

  • -
  • className – The class name that the method is part of -(defaults to org.hamcrest.Matchers). -Can be fully qualified, or simple, and simple defaults to androidx.test.espresso.matcher package -(e.g.: class=CursorMatchers fully qualified is class=androidx.test.espresso.matcher.CursorMatchers

  • -
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
Raises
-

TypeError - Raises a TypeError if the arguments are not validated for JSON format

-
-
-
-
Usage:

driver.find_element_by_android_data_matcher(name=’hasEntry’, args=[‘title’, ‘Animation’])

-
-
-
- -
-
-find_element_by_android_uiautomator(uia_string: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.ANDROID_UIAUTOMATOR’ instead.

-
-
-

Finds element by uiautomator in Android.

-
-
Parameters
-

uia_string – The element name in the Android UIAutomator library

-
-
-
-
Usage:

driver.find_element_by_android_uiautomator(‘.elements()[1].cells()[2]’)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_element_by_android_view_matcher(name: Optional[str] = None, args: Optional[Any] = None, className: Optional[str] = None) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.ANDROID_VIEW_MATCHER’ instead.

-
-
-

Finds element by [onView](https://developer.android.com/training/testing/espresso/basics) in Android

-

It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).

-
-
Parameters
-
    -
  • name – The name of a method to invoke. -The method must return a Hamcrest -[Matcher](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)

  • -
  • args – The args provided to the method

  • -
  • className – The class name that the method is part of (defaults to org.hamcrest.Matchers). -Can be fully qualified by having the androidx.test.espresso.matcher. prefix. -If the prefix is not provided then it is going to be added implicitly. -(e.g.: class=CursorMatchers fully qualified is class=androidx.test.espresso.matcher.CursorMatchers

  • -
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
Raises
-

TypeError - Raises a TypeError if the arguments are not validated for JSON format

-
-
-
-
Usage:
-
driver.find_element_by_android_view_matcher(

name=’withText’, args=[‘Accessibility’], className=’ViewMatchers’

-
-
-

)

-
-
-
- -
-
-find_element_by_android_viewtag(tag: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.ANDROID_VIEWTAG’ instead.

-
-
-

Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.

-

It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).

-
-
Parameters
-

tag – The tag name of the view to look for

-
-
-
-
Usage:

driver.find_element_by_android_viewtag(‘a tag name’)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_android_data_matcher(name: Optional[str] = None, args: Optional[Any] = None, className: Optional[str] = None) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.ANDROID_DATA_MATCHER’ instead.

-
-
-

Finds elements by -[onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android -It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).

-
-
Parameters
-
    -
  • name – The name of a method to invoke. -The method must return a Hamcrest -[Matcher](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html)

  • -
  • args – The args provided to the method

  • -
  • className – The class name that the method is part of -(defaults to org.hamcrest.Matchers). -Can be fully qualified, or simple, and simple defaults to androidx.test.espresso.matcher package -(e.g.: class=CursorMatchers fully qualified is class=androidx.test.espresso.matcher.CursorMatchers

  • -
-
-
Returns
-

The found elements

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
-
Usage:

driver.find_elements_by_android_data_matcher(name=’hasEntry’, args=[‘title’, ‘Animation’])

-
-
-
- -
-
-find_elements_by_android_uiautomator(uia_string: str) List[WebElement]
-

[Deprecated] Please use ‘find_elements’ with ‘AppiumBy.ANDROID_UIAUTOMATOR’ instead.

-

Finds elements by uiautomator in Android.

-
-
Parameters
-

uia_string – The element name in the Android UIAutomator library

-
-
-
-
Usage:

driver.find_elements_by_android_uiautomator(‘.elements()[1].cells()[2]’)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_android_viewtag(tag: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.ANDROID_VIEWTAG’ instead.

-
-
-

Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.

-

It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).

-
-
Parameters
-

tag – The tag name of the view to look for

-
-
-
-
Usage:

driver.find_elements_by_android_viewtag(‘a tag name’)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
- -
-
-

webdriver.extensions.search_context.custom module

-
-
-class CustomSearchContext(*args, **kwargs)
-

Bases: appium.protocols.webdriver.can_find_elements.CanFindElements

-

Define search context for custom plugin

-
-
-find_element_by_custom(selector: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.CUSTOM’ instead.

-
-
-

Finds an element in conjunction with a custom element finding plugin

-
-
Parameters
-

selector – a string of the form “module:selector”, where “module” is -the shortcut name given in the customFindModules capability, and -“selector” is the string that will be passed to the custom element -finding plugin itself

-
-
-
-
Usage:

driver.find_element_by_custom(“foo:bar”)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_custom(selector: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.CUSTOM’ instead.

-
-
-

Finds elements in conjunction with a custom element finding plugin

-
-
Parameters
-

selector – a string of the form “module:selector”, where “module” is -the shortcut name given in the customFindModules capability, and -“selector” is the string that will be passed to the custom element -finding plugin itself

-
-
-
-
Usage:

driver.find_elements_by_custom(“foo:bar”)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
- -
-
-

webdriver.extensions.search_context.ios module

-
-
-class iOSSearchContext(*args, **kwargs)
-

Bases: appium.protocols.webdriver.can_find_elements.CanFindElements

-

Define search context for iOS

-
-
-find_element_by_ios_class_chain(class_chain_string: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.IOS_CLASS_CHAIN’ instead.

-
-
-

Find an element by ios class chain string.

-
-
Parameters
-

class_chain_string – The class chain string

-
-
-
-
Usage:

driver.find_element_by_ios_class_chain(‘XCUIElementTypeWindow/XCUIElementTypeButton[3]’)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_element_by_ios_predicate(predicate_string: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.IOS_PREDICATE’ instead.

-
-
-

Find an element by ios predicate string.

-
-
Parameters
-

predicate_string – The predicate string

-
-
-
-
Usage:

driver.find_element_by_ios_predicate(‘label == “myLabel”’)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_element_by_ios_uiautomation(uia_string: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.IOS_UIAUTOMATION’ instead.

-
-
-

Finds an element by uiautomation in iOS.

-
-
Parameters
-

uia_string – The element name in the iOS UIAutomation library

-
-
-
-
Usage:

driver.find_element_by_ios_uiautomation(‘.elements()[1].cells()[2]’)

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_ios_class_chain(class_chain_string: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.IOS_CLASS_CHAIN’ instead.

-
-
-

Finds elements by ios class chain string.

-
-
Parameters
-

class_chain_string – The class chain string

-
-
-
-
Usage:

driver.find_elements_by_ios_class_chain(‘XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]’)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_ios_predicate(predicate_string: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.IOS_PREDICATE’ instead.

-
-
-

Finds elements by ios predicate string.

-
-
Parameters
-

predicate_string – The predicate string

-
-
-
-
Usage:

driver.find_elements_by_ios_predicate(‘label == “myLabel”’)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_ios_uiautomation(uia_string: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.IOS_UIAUTOMATION’ instead.

-
-
-

Finds elements by uiautomation in iOS.

-
-
Parameters
-

uia_string – The element name in the iOS UIAutomation library

-
-
-
-
Usage:

driver.find_elements_by_ios_uiautomation(‘.elements()[1].cells()[2]’)

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
- -
-
-

webdriver.extensions.search_context.mobile module

-
-
-class MobileSearchContext(*args, **kwargs)
-

Bases: appium.protocols.webdriver.can_find_elements.CanFindElements

-

Define search context for Mobile(Android, iOS)

-
-
-find_element_by_accessibility_id(accessibility_id: str) WebElement
-
-
deprecated:: 2.1.0

Please use ‘find_element’ with ‘AppiumBy.ACCESSIBILITY_ID’ instead.

-
-
-

Finds an element by accessibility id.

-
-
Parameters
-

accessibility_id – A string corresponding to a recursive element search using the -Id/Name that the native Accessibility options utilize

-
-
-
-
Usage:

driver.find_element_by_accessibility_id()

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_element_by_image(img_path: str) WebElement
-

Finds a portion of a screenshot by an image.

-

Uses driver.find_image_occurrence under the hood.

-
-
Parameters
-

img_path – a string corresponding to the path of a image

-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_accessibility_id(accessibility_id: str) List[WebElement]
-
-
deprecated:: 2.1.0

Please use ‘find_elements’ with ‘AppiumBy.ACCESSIBILITY_ID’ instead.

-
-
-

Finds elements by accessibility id.

-
-
Parameters
-

accessibility_id – a string corresponding to a recursive element search using the -Id/Name that the native Accessibility options utilize

-
-
-
-
Usage:

driver.find_elements_by_accessibility_id()

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_image(img_path: str) List[WebElement]
-

Finds a portion of a screenshot by an image.

-

Uses driver.find_image_occurrence under the hood. Note that this will -only ever return at most one element

-
-
Parameters
-

img_path – a string corresponding to the path of a image

-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
- -
-
-

webdriver.extensions.search_context.windows module

-
-
-class WindowsSearchContext(*args, **kwargs)
-

Bases: appium.protocols.webdriver.can_find_elements.CanFindElements

-

Define search context for Windows

-
-
-find_element_by_windows_uiautomation(win_uiautomation: str) WebElement
-

[Deprecated] Finds an element by windows uiautomation

-
-
Parameters
-

win_uiautomation – The element name in the windows UIAutomation selector

-
-
-
-
Usage:

driver.find_element_by_windows_uiautomation()

-
-
-
-
Returns
-

The found element

-
-
Return type
-

appium.webdriver.webelement.WebElement

-
-
-
- -
-
-find_elements_by_windows_uiautomation(win_uiautomation: str) List[WebElement]
-

[Deprecated] Finds elements by windows uiautomation

-
-
Parameters
-

win_uiautomation – The element name in the windows UIAutomation selector

-
-
-
-
Usage:

driver.find_elements_by_windows_uiautomation()

-
-
-
-
Returns
-

The found elements

-
-
Return type
-

list of appium.webdriver.webelement.WebElement

-
-
-
- -
- -
-
-

Module contents

-
-
-class AppiumSearchContext(*args, **kwargs)
-

Bases: webdriver.extensions.search_context.android.AndroidSearchContext, webdriver.extensions.search_context.custom.CustomSearchContext, webdriver.extensions.search_context.ios.iOSSearchContext, webdriver.extensions.search_context.mobile.MobileSearchContext, webdriver.extensions.search_context.windows.WindowsSearchContext

-

Returns appium driver search context

-
- -
-
-class AppiumWebElementSearchContext(*args, **kwargs)
-

Bases: webdriver.extensions.search_context.android.AndroidSearchContext, webdriver.extensions.search_context.custom.CustomSearchContext, webdriver.extensions.search_context.ios.iOSSearchContext, webdriver.extensions.search_context.mobile.MobileSearchContext, webdriver.extensions.search_context.windows.WindowsSearchContext

-

Returns appium web element search context

-
- -
-
- - -
-