Additional Questions
These are the Questions added in ScreenPy Selenium.
Attribute
Aliases: TheAttribute
- class Attribute(attribute: str)
Ask about an attribute on an element.
- Abilities Required:
Examples:
the_actor.should( See.the( Attribute("value").of_the(NAME_INPUT), ReadsExactly("Jessica Walters")), ), See.the( Attribute("aria-label").of_the(BALLOONS), ContainsTheText("balloon")), ), )
BrowserTitle
Aliases: TheBrowserTitle
- class BrowserTitle
Ask what the title of the browser’s active window is.
- Abilities Required:
Examples:
the_actor.should(See.the(BrowserTitle(), ReadsExactly("Welcome!")))
BrowserURL
Aliases: TheBrowserURL
- class BrowserURL
Ask what the url of the browser’s active window is.
- Abilities Required:
Examples:
the_actor.should(See.the(BrowserURL(), ContainsTheText("/screenplays")))
Element
Aliases: TheElement
List
Aliases: TheList
Number
Aliases: TheNumber
Selected
Aliases: TheSelected
- class Selected(target: Target, multi: bool = False)
Ask for the text of selected option(s) in a dropdown or multi-select field.
- Abilities Required:
Examples:
the_actor.should( See.the(Selected.option_from(THE_STATE_DROPDOWN), ReadsExactly("Minnesota")) ) the_actor.should(See.the(Selected.options_from(INDUSTRIES), HasLength(5)))
- classmethod option_from_the(target: Target) Self
Get the option.
Get the option that is currently selected in a dropdown or the first option selected in a multi-select field.
Note: if this method is used for a multi-select field, only the first selected option will be returned.
- Aliases:
option_from()
- classmethod options_from_the(multiselect_target: Target) Self
Get all the options that are currently selected in a multi-select field.
Note: this method should not be used for single-select dropdowns, that will cause a NotImplemented error to be raised from Selenium when answering this Question.
- Aliases:
options_from()
Text
Aliases: TheText
- class Text(target: Target, multi: bool = False)
Ask what text appears in an element or elements.
- Abilities Required:
Examples:
the_actor.should( See.the(Text.of(THE_WELCOME_HEADER), ReadsExactly("Welcome!")) ) the_actor.should( See.the(Text.of_all(SEARCH_RESULTS), ContainsTheItem("Rear Window")) )
TextOfTheAlert
Aliases: TheTextOfTheAlert
- class TextOfTheAlert
Ask what text appears in the alert.
- Abilities Required:
Examples:
the_actor.should( See.the(TextOfTheAlert(), ReadsExactly("Danger, Will Robinson!")) )