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"))
- classmethod the(description: str) screenpy_appium.target.Target¶
Provide a human-readable description for the element.
- located_by(locator: Union[Tuple[str, str], str]) screenpy_appium.target.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: Union[Tuple[str, str], str]) screenpy_appium.target.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: screenpy.actor.Actor) appium.webdriver.webelement.WebElement¶
Retrieve the
WebElementas viewed by the Actor.
- all_found_by(the_actor: screenpy.actor.Actor) List[appium.webdriver.webelement.WebElement]¶
Retrieve a list of
WebElementobjects as viewed by the Actor.