Target API¶
This is the Target class and its API.
Target¶
- class Target(description: str)¶
Describe an element with a human-readable string and a locator.
- Abilities Required:
Examples:
# assumes by Accessibility ID Target.the("accept button").located_by('"Accept" Button') # assumes by XPATH Target.the("username field").located_by("//android.widget.EditText") Target.the('"Log In" button').located((AppiumBy.NAME, "login"))
- located_by(locator: tuple[str, str] | str) Target¶
Set the locator for this Target.
- Possible values for locator:
A tuple of an AppiumBy classifier and a string (e.g.
(AppiumBy.NAME, "welcome"))An Accessibility ID string (e.g.
"Accept Button")An XPATH string (e.g.
"//div/h3")
- located(locator: tuple[str, str] | str) Target¶
Set the locator for this Target.
- Possible values for locator:
A tuple of an AppiumBy classifier and a string (e.g.
(AppiumBy.NAME, "welcome"))An Accessibility ID string (e.g.
"Accept Button")An XPATH string (e.g.
"//div/h3")
- get_locator() tuple[str, str]¶
Return the stored locator.
- Raises:
TargetingError: if no locator was set.
- found_by(the_actor: Actor) WebElement¶
Retrieve the
WebElementas viewed by the Actor.
- all_found_by(the_actor: Actor) list[WebElement]¶
Retrieve a list of
WebElementobjects as viewed by the Actor.