Class: HTMLSelectDriver
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:16
Extends​
ComponentDriver<{ }>
Implements​
IInputDriver<Nullable<ValueT>>
Constructors​
Constructor​
new HTMLSelectDriver(
locator,interactor,option?):HTMLSelectDriver
Defined in: core/dist/index.d.cts:676
Parameters​
locator​
PartLocator
interactor​
Interactor
option?​
Partial<IComponentDriverOption<{ }>>
Returns​
HTMLSelectDriver
Inherited from​
ComponentDriver<{}>.constructor
Properties​
commutableOption​
readonlycommutableOption:IComponentDriverOption<{ }>
Defined in: core/dist/index.d.cts:675
Option passed to the constructor includes both universal options which can be shared across all component driver tree, and component specific options which are only applicable to the component.
Commutable option is the option that can be shared across all component driver tree.
Inherited from​
ComponentDriver.commutableOption
interactor​
readonlyinteractor:Interactor
Defined in: core/dist/index.d.cts:666
Inherited from​
ComponentDriver.interactor
Accessors​
driverName​
Get Signature​
get driverName():
string
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:113
Identifier for this driver.
Returns​
string
Overrides​
ComponentDriver.driverName
locator​
Get Signature​
get locator():
PartLocator
Defined in: core/dist/index.d.cts:706
Return the locator of the component
Returns​
PartLocator
Inherited from​
ComponentDriver.locator
parts​
Get Signature​
get parts():
ScenePartDriver<T>
Defined in: core/dist/index.d.cts:702
Return driver instance of all the named parts
Returns​
ScenePartDriver<T>
Inherited from​
ComponentDriver.parts
Methods​
click()​
click(
option?):Promise<void>
Defined in: core/dist/index.d.cts:730
Parameters​
option?​
Partial<ClickOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.click
enforcePartExistence()​
protectedenforcePartExistence(partName):Promise<void>
Defined in: core/dist/index.d.cts:712
Check the specified parts' existences, and throw MissingPartError if any of the part is found not existence. Existence is defined by the part's existence in the DOM regardless of its visibility on the screen
Parameters​
partName​
readonly never[]
Single or array of the names of the parts to be enforced
Returns​
Promise<void>
Inherited from​
ComponentDriver.enforcePartExistence
exists()​
exists():
Promise<boolean>
Defined in: core/dist/index.d.cts:729
Whether the component exists/attached to the DOM
Returns​
Promise<boolean>
true if the component is attached to the DOM, false otherwise
Inherited from​
ComponentDriver.exists
focus()​
focus(
option?):Promise<void>
Defined in: core/dist/index.d.cts:739
Parameters​
option?​
Partial<FocusOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.focus
getAttribute()​
getAttribute(
attributeName):Promise<Optional<string>>
Defined in: core/dist/index.d.cts:724
Parameters​
attributeName​
string
Returns​
Promise<Optional<string>>
Inherited from​
ComponentDriver.getAttribute
getMissingPartNames()​
protectedgetMissingPartNames(partName):Promise<readonlynever[]>
Defined in: core/dist/index.d.cts:718
Get the names of parts not in the DOM
Parameters​
partName​
readonly never[]
Single or array of the names of the parts to be examined
Returns​
Promise<readonly never[]>
Inherited from​
ComponentDriver.getMissingPartNames
getSelectedLabel()​
Retrieve the label text for the currently selected option(s).
Call Signature​
getSelectedLabel(
isMultiple):Promise<readonlystring[] |null>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:79
Parameters​
isMultiple​
true
Returns​
Promise<readonly string[] | null>
Call Signature​
getSelectedLabel(
isMultiple):Promise<string|null>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:80
Parameters​
isMultiple​
false
Returns​
Promise<string | null>
Call Signature​
getSelectedLabel():
Promise<string|null>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:81
Returns​
Promise<string | null>
getText()​
getText():
Promise<Optional<string>>
Defined in: core/dist/index.d.cts:723
Get the combined text content of the component
Returns​
Promise<Optional<string>>
If the component exists and has content, it should return the text or otherwise undefined
Inherited from​
ComponentDriver.getText
getValue()​
getValue():
Promise<Nullable<ValueT>>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:31
Get the current value(s) of the select element.
Returns​
Promise<Nullable<ValueT>>
null when nothing is selected, otherwise the selected value or
array of values depending on the multiple attribute.
Implementation of​
IInputDriver.getValue
getValuesByLabels()​
getValuesByLabels(
labels):Promise<readonlystring[]>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:56
Resolve option values from their visible labels.
Parameters​
labels​
readonly string[]
Returns​
Promise<readonly string[]>
hover()​
hover(
option?):Promise<void>
Defined in: core/dist/index.d.cts:731
Parameters​
option?​
Partial<HoverOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.hover
innerHTML()​
innerHTML():
Promise<string>
Defined in: core/dist/index.d.cts:771
Get the inner HTML of the component
Returns​
Promise<string>
The inner HTML of the component
Inherited from​
ComponentDriver.innerHTML
isDisabled()​
isDisabled():
Promise<boolean>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:99
Check whether the select element is disabled.
Returns​
Promise<boolean>
isMultiple()​
isMultiple():
Promise<boolean>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:20
Determine whether the select element allows multiple selections.
Returns​
Promise<boolean>
isReadonly()​
isReadonly():
Promise<boolean>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:106
Check whether the select element is read only.
Returns​
Promise<boolean>
isVisible()​
isVisible():
Promise<boolean>
Defined in: core/dist/index.d.cts:748
Whether the component is visible. Visibility is defined
that the component does not have the CSS property display: none,
visibility: hidden, or opacity: 0. However this does not
check whether the component is within the viewport.
Returns​
Promise<boolean>
true if the component is visible, false otherwise
Inherited from​
ComponentDriver.isVisible
mouseDown()​
mouseDown(
option?):Promise<void>
Defined in: core/dist/index.d.cts:733
Parameters​
option?​
Partial<MouseDownOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseDown
mouseEnter()​
mouseEnter(
option?):Promise<void>
Defined in: core/dist/index.d.cts:737
Parameters​
option?​
Partial<MouseEnterOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseEnter
mouseLeave()​
mouseLeave(
option?):Promise<void>
Defined in: core/dist/index.d.cts:738
Parameters​
option?​
Partial<MouseLeaveOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseLeave
mouseMove()​
mouseMove(
option?):Promise<void>
Defined in: core/dist/index.d.cts:732
Parameters​
option?​
Partial<MouseMoveOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseMove
mouseOut()​
mouseOut(
option?):Promise<void>
Defined in: core/dist/index.d.cts:736
Parameters​
option?​
Partial<MouseOutOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseOut
mouseOver()​
mouseOver(
option?):Promise<void>
Defined in: core/dist/index.d.cts:735
Parameters​
option?​
Partial<HoverOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseOver
mouseUp()​
mouseUp(
option?):Promise<void>
Defined in: core/dist/index.d.cts:734
Parameters​
option?​
Partial<MouseUpOption>
Returns​
Promise<void>
Inherited from​
ComponentDriver.mouseUp
overriddenParentLocator()​
overriddenParentLocator():
Optional<PartLocator>
Defined in: core/dist/index.d.cts:686
Usually this should be undefined as the component driver corresponds to a component nested inside the parent DOM, thus the driver's locator would automatically chain with its parent's locator.
When the component is rendered outside the parent's DOM, which usually happens when the component is a modal or popup, supply the PartLocator on how to locate the component with the component's own locator.
Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties
Returns​
Optional<PartLocator>
Inherited from​
ComponentDriver.overriddenParentLocator
overrideLocatorRelativePosition()​
overrideLocatorRelativePosition():
Optional<LocatorRelativePosition>
Defined in: core/dist/index.d.cts:698
Usually this should be undefined when the locator is defined by the ScenePart, thus it reflects the natural relative position of the component
However, in some implementation such as MUI v5 dialog, the actual dialog DOM is rendered outside the parent DOM, and the selector is "siblings", by defining this function, it allows the driver to have the knowledge of the actual relative position instead of offloading the knowledge to the consumer.
Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties
Returns​
Optional<LocatorRelativePosition>
Inherited from​
ComponentDriver.overrideLocatorRelativePosition
runtimeCssSelector()​
runtimeCssSelector():
Promise<string>
Defined in: core/dist/index.d.cts:777
Get the runtime CSS selector of the component. This is useful for debugging and testing purposes.
Returns​
Promise<string>
The runtime CSS selector of the component
Inherited from​
ComponentDriver.runtimeCssSelector
selectByLabel()​
selectByLabel(
label):Promise<void>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:73
Select option(s) using their labels rather than values.
Parameters​
label​
string | readonly string[]
Returns​
Promise<void>
setValue()​
setValue(
value):Promise<boolean>
Defined in: component-driver-html/src/components/HTMLSelectDriver.ts:44
Select one or more options based on their value attribute.
Parameters​
value​
Nullable<ValueT>
Value or list of values to select. Use null to clear the
selection.
Returns​
Promise<boolean>
Implementation of​
IInputDriver.setValue
waitUntil()​
waitUntil<
T>(option):Promise<T>
Defined in: core/dist/index.d.cts:766
Type Parameters​
T​
T
Parameters​
option​
WaitUntilOption<T>
Returns​
Promise<T>
Inherited from​
ComponentDriver.waitUntil
waitUntilComponentState()​
waitUntilComponentState(
option?):Promise<void>
Defined in: core/dist/index.d.cts:765
Wait until the component is in the expected state such as the component's visibility or existence. If the component has not reached the expected state within the timeout, it will throw an error.
By default it waits until the component is attached to the DOM within 30 seconds.
Parameters​
option?​
Partial<Readonly<WaitForOption>>
The option to configure the wait behavior
Returns​
Promise<void>
Inherited from​
ComponentDriver.waitUntilComponentState
waitUntilVisible()​
waitUntilVisible(
timeoutMs?):Promise<void>
Defined in: core/dist/index.d.cts:753
Wait until the component is attached and becomes visible to the DOM.
Parameters​
timeoutMs?​
number
The number of milliseconds to wait before timing out
Returns​
Promise<void>
Inherited from​
ComponentDriver.waitUntilVisible