abstractPageElement <Native_Element_Type>
Implements
- Optional
- Switchable
Index
Methods
staticfrom
Type parameters
- NET
Parameters
nativeElement: NET
Returns MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>
staticlocated
Type parameters
- NET
Parameters
selector: Answerable<Selector>
Returns MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>
staticof
Type parameters
- NET
Parameters
childElement: PageElement<NET> | MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>
parentElement: Answerable<PageElement<NET>>
Returns MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>
abstractof
Locates a child element that:
- matches the given selector
- is located within the
parentElement
Parameters
parentElement: PageElement<Native_Element_Type>
Returns PageElement<Native_Element_Type>
abstractclosestTo
Traverses the element and its parents, heading toward the document root, until it finds a parent PageElement that matches its associated CSS selector.
Example
<div class="form-entry">
<input id="username" />
<ul class="warnings">
<li>Username should be an email address</li>
</ul>
</div>class Username {
static field = () =>
PageElement.located(By.id('username'))
.describedAs('username field')
private static container = () =>
PageElement.located(By.css('.form-entry'))
.describedAs('form entry container')
static warnings = () =>
PageElements.located(By.css('ul.warnings li'))
.describedAs('warnings')
.of(
Username.container().closestTo(Username.field())
)
}infoThis method relies on Element: closest() API, and so is only compatible with locating parent elements specified using the following CSS selectors:
Parameters
childElement: PageElement<Native_Element_Type>
Returns PageElement<Native_Element_Type>
Learn more
nativeElement
An âescape hatchâ providing access to the integration tool-specific implementation of a Web element.
Returns Promise<Native_Element_Type>
toString
Returns string
abstractenterValue
Parameters
value: string | number | (string | number)[]
Returns Promise<void>
abstractclearValue
Returns Promise<void>
abstractclick
Returns Promise<void>
abstractdoubleClick
Returns Promise<void>
abstractscrollIntoView
Returns Promise<void>
abstracthoverOver
Returns Promise<void>
abstractrightClick
Returns Promise<void>
abstractselectOptions
Parameters
rest...options: SelectOption[]
Returns Promise<void>
abstractselectedOptions
Returns Promise<SelectOption[]>
abstractattribute
Parameters
name: string
Returns Promise<string>
abstracttext
Returns Promise<string>
abstractvalue
Returns Promise<string>
abstractswitchTo
When the element represents an
iframe
, calling this method switches the current browsing context to the giveniframe
context.When used with other types of Web
Element
, calling this method will have the same result as callingElement.focus()
.Returns Promise<SwitchableOrigin>
Returns an object that allows the caller to switch back to the previous context if needed.
Learn more
abstractisActive
Resolves to
true
when the underlying element has focus. Otherwise, resolves tofalse
.Returns Promise<boolean>
abstractisClickable
Resolves to
true
when the underlying element can be clicked on. Otherwise, resolves tofalse
.Please refer to test integration tool-specific documentation for details.
Returns Promise<boolean>
abstractisEnabled
Resolves to
true
when the underlying element is not explicitly disabledPlease refer to test integration tool-specific documentation for details.
Returns Promise<boolean>
isPresent
Returns a Promise that resolves to
true
when the element is present in the Document Object Model (DOM),false
otherwise.Returns Promise<boolean>
abstractisSelected
Resolves to
true
when the underlying element:- has a
selected
attribute for<option />
elements - has a
checked
attribute for checkboxes
Otherwise, resolves to
false
.Returns Promise<boolean>
- has a
abstractisVisible
Resolves to
true
when the underlying element:- is not hidden, so doesnât have CSS style like
display: none
,visibility: hidden
oropacity: 0
- is within the browser viewport
- doesnât have its centre covered by other elements
Otherwise, resolves to
false
.Returns Promise<boolean>
- is not hidden, so doesnât have CSS style like
Constructors
constructor
Type parameters
- Native_Element_Type = any
Parameters
locator: Locator<Native_Element_Type, any>
Returns PageElement<Native_Element_Type>
Uses the actorâs ability to BrowseTheWeb to identify a single Web element located by Selector.
Learn more