Select
class Select extends AbstractTypifiedElement implements ISimpleSetter (View source)
Represents web page select control.
Constants
CRITERION_TAG |
|
CRITERION_ATTRS |
|
Properties
private string | $_name | Name of the element. | from AbstractTypifiedElement |
private WebElement | $_wrappedElement | Wrapped element. | from AbstractTypifiedElement |
private IPageFactory | $_pageFactory | Stores instance of used page factory. | from AbstractTypifiedElement |
protected array | $acceptanceCriteria | List of acceptance criteria. |
Methods
Creates Element instance based on existing NodeElement instance.
Checks that wrapped element meets the acceptance criteria.
Checks if the tag name(s) of the criterion are matching.
Checks if the attributes of the criterion are matching.
Checks if passed value matching the defined criterion.
Returns page factory, used during object creation.
Checks whether element has attribute with specified name.
Returns specified attribute value.
Indicates whether this select element support selecting multiple options at the same time.
Returns all options belonging to this select tag.
Returns all options having given value.
Returns all options that display text matching the argument.
Returns all selected options belonging to this select tag.
The first selected option in this select tag (or the currently selected option in a normal select).
Select all options that display text matching the argument.
Deselect all options that display text matching the argument.
Select all options that have a value matching the argument.
Deselect all options that have a value matching the argument.
Replaces current selection with given one.
Deselects all options.
Sets value to the element.
Select given options.
Wraps each of NodeElement in array with a SelectOption class.
Throws an exception when it's not a multiselect.
Details
__construct(WebElement $wrapped_element, IPageFactory $page_factory)
Specifies wrapped WebElement.
static INodeElementAware
fromNodeElement(NodeElement $node_element, IPageFactory $page_factory)
Creates Element instance based on existing NodeElement instance.
protected void
assertWrappedElement()
Checks that wrapped element meets the acceptance criteria.
protected boolean
isTagNameMatching(array $criterion)
Checks if the tag name(s) of the criterion are matching.
protected boolean
isAttributeMatching(array $criterion)
Checks if the attributes of the criterion are matching.
protected boolean
isValueMatchingCriterionDefinition(string $value, string $criterion)
Checks if passed value matching the defined criterion.
WebElement
getWrappedElement()
Returns wrapped element.
ITypifiedElement
setName(string $name)
Sets a name of an element.
This method is used by initialization mechanism and is not intended to be used directly.
string
getName()
Returns name of the entity.
Session
getSession()
deprecated
deprecated
Returns element session.
protected IPageFactory
getPageFactory()
Returns page factory, used during object creation.
boolean
isVisible()
Checks whether current node is visible on page.
boolean
isValid()
Checks if an element is still valid.
boolean
hasAttribute(string $name)
Checks whether element has attribute with specified name.
mixed|null
getAttribute(string $name)
Returns specified attribute value.
string
getXpath()
Returns XPath for handled element.
string
getTagName()
Returns current node tag name.
Escaper
getXpathEscaper()
Returns the XPath escaper.
protected boolean
isSeleniumDriver()
Checks, that Selenium driver is used.
string
__toString()
Returns string representation of element.
Expectation
shouldReceive(string $name)
at line 38
boolean
isMultiple()
Indicates whether this select element support selecting multiple options at the same time.
at line 48
SelectOption[]
getOptions()
Returns all options belonging to this select tag.
at line 60
SelectOption[]
getOptionsByValue(mixed $value)
Returns all options having given value.
at line 75
SelectOption[]
getOptionsByText(string $text, boolean $exact_match = true)
Returns all options that display text matching the argument.
at line 94
SelectOption[]
getSelectedOptions()
Returns all selected options belonging to this select tag.
at line 113
SelectOption
getFirstSelectedOption()
The first selected option in this select tag (or the currently selected option in a normal select).
at line 133
Select
selectByText(string $text, boolean $exact_match = true)
Select all options that display text matching the argument.
at line 152
Select
deselectByText(string $text, boolean $exact_match = true)
Deselect all options that display text matching the argument.
at line 169
Select
selectByValue(mixed $value)
Select all options that have a value matching the argument.
at line 187
Select
deselectByValue(mixed $value)
Deselect all options that have a value matching the argument.
at line 254
ISimpleSetter
setValue(mixed $value)
Sets value to the element.
at line 271
protected Select
selectOptions(array $options, boolean $first_only = false)
Select given options.
at line 291
protected SelectOption[]
wrapOptions(array $nodes)
Wraps each of NodeElement in array with a SelectOption class.
at line 310
protected void
assertMultiSelect()
Throws an exception when it's not a multiselect.