- Browser
- BrowserWebElementByJs
- BrowserWebElementByLocator
- BrowserWebElementsByJs
- BrowserWebElementsByLocator
- ByIndexWebElementLocator
- CannotPerformActionError
- CashedWebElementLocator
- CollectedByLocator
- Collection
- Command
- Condition
- ConditionNotMatchedError
- Configuration
- Customized
- Element
- ElementByConditionWebElementLocator
- ElementWebElementByJs
- ElementWebElementByLocator
- ElementWebElementsByJs
- ElementWebElementsByLocator
- Entity
- FailedToMatchConditionWithReasonError
- FilteredByConditionWebElementsLocator
- Query
- Shadow
- SlicedWebElementsLocator
- TimeoutError
- Wait
• Extensions:
Defined in lib/utils/extensions.ts:24
▸ isAbsoluteUrl(relativeOrAbsoluteUrl
: string): boolean
Defined in lib/utils/extensions.ts:53
Parameters:
Name | Type |
---|---|
relativeOrAbsoluteUrl |
string |
Returns: boolean
▸ savePageSource(driver
: WebDriver, filePath
: string): Promise‹string›
Defined in lib/utils/extensions.ts:27
Parameters:
Name | Type |
---|---|
driver |
WebDriver |
filePath |
string |
Returns: Promise‹string›
▸ saveScreenshot(driver
: WebDriver, filePath
: string): Promise‹string›
Defined in lib/utils/extensions.ts:37
Parameters:
Name | Type |
---|---|
driver |
WebDriver |
filePath |
string |
Returns: Promise‹string›
▸ toBy(cssOrXpathOrBy
: string | By): By
Defined in lib/utils/extensions.ts:47
Parameters:
Name | Type |
---|---|
cssOrXpathOrBy |
string | By |
Returns: By
• be:
Defined in lib/support/conditions/be.ts:19
• absent: ElementCondition = condition.element.isAbsent
Defined in lib/support/conditions/be.ts:24
• blank: ElementCondition = condition.element.isBlank
Defined in lib/support/conditions/be.ts:38
• disabled: ElementCondition = condition.element.isDisabled
Defined in lib/support/conditions/be.ts:36
• enabled: ElementCondition = condition.element.isEnabled
Defined in lib/support/conditions/be.ts:34
• focused: ElementCondition = condition.element.isFocused
Defined in lib/support/conditions/be.ts:32
Const
hidden
• hidden: ElementCondition = condition.element.isHidden
Defined in lib/support/conditions/be.ts:30
• not: be = new Proxy(be, { get: (be, conditionName) => Condition.not(be[conditionName]) })
Defined in lib/support/conditions/be.ts:20
• present: ElementCondition = condition.element.isPresent
Defined in lib/support/conditions/be.ts:26
• selected: ElementCondition = condition.element.isSelected
Defined in lib/support/conditions/be.ts:22
• visible: ElementCondition = condition.element.isVisible
Defined in lib/support/conditions/be.ts:28
• by:
Defined in lib/support/selectors/by.ts:19
• NORMALIZE_SPACE_XPATH: *"normalize-space(translate(string(.), '
', ' '))"* = "normalize-space(translate(string(.), '
', ' '))"
Defined in lib/support/selectors/by.ts:21
▸ attribute(attributeName
: string, attributeValue
: string): By
Defined in lib/support/selectors/by.ts:69
Parameters:
Name | Type |
---|---|
attributeName |
string |
attributeValue |
string |
Returns: By
▸ className(className
: string): By
Defined in lib/support/selectors/by.ts:57
Parameters:
Name | Type |
---|---|
className |
string |
Returns: By
▸ css(css
: string): By
Defined in lib/support/selectors/by.ts:65
Parameters:
Name | Type |
---|---|
css |
string |
Returns: By
▸ exactText(text
: string): By‹›
Defined in lib/support/selectors/by.ts:41
Parameters:
Name | Type |
---|---|
text |
string |
Returns: By‹›
▸ id(id
: string): By
Defined in lib/support/selectors/by.ts:49
Parameters:
Name | Type |
---|---|
id |
string |
Returns: By
▸ linkText(text
: string): By
Defined in lib/support/selectors/by.ts:45
Parameters:
Name | Type |
---|---|
text |
string |
Returns: By
▸ name(name
: string): By
Defined in lib/support/selectors/by.ts:53
Parameters:
Name | Type |
---|---|
name |
string |
Returns: By
▸ partialId(...idParts
: string[]): By
Defined in lib/support/selectors/by.ts:32
Parameters:
Name | Type |
---|---|
...idParts |
string[] |
Returns: By
▸ text(text
: string): By‹›
Defined in lib/support/selectors/by.ts:37
Parameters:
Name | Type |
---|---|
text |
string |
Returns: By‹›
▸ type(type
: string): By
Defined in lib/support/selectors/by.ts:23
Parameters:
Name | Type |
---|---|
type |
string |
Returns: By
▸ value(value
: string): By
Defined in lib/support/selectors/by.ts:27
Parameters:
Name | Type |
---|---|
value |
string |
Returns: By
▸ xpath(xpath
: string): By
Defined in lib/support/selectors/by.ts:61
Parameters:
Name | Type |
---|---|
xpath |
string |
Returns: By
• command:
Defined in lib/commands.ts:18
• js:
Defined in lib/commands.ts:31
• click: (Anonymous function) = lambda('click by js', clickWithOffset(0, 0))
Defined in lib/commands.ts:53
• scrollIntoView: (Anonymous function) = lambda('scroll into view', async element => element.executeScript((element: HTMLInputElement) => element.scrollIntoView(true)))
Defined in lib/commands.ts:89
▸ clickWithOffset(xOffset
: number, yOffset
: number): (Anonymous function)
Defined in lib/commands.ts:35
Parameters:
Name | Type |
---|---|
xOffset |
number |
yOffset |
number |
Returns: (Anonymous function)
▸ setValue(value
: string | number): (Anonymous function)
Defined in lib/commands.ts:55
Parameters:
Name | Type |
---|---|
value |
string | number |
Returns: (Anonymous function)
▸ type(keys
: string | number): (Anonymous function)
Defined in lib/commands.ts:73
Parameters:
Name | Type |
---|---|
keys |
string | number |
Returns: (Anonymous function)
• condition:
Defined in lib/conditions.ts:90
The list of predefined conditions for all type of entities:
- condition.element.*
- condition.collection.*
- condition.browser.*
Can be used in the following way:
await browser.all('.google-result').should(condition.collection.have.size(10))
Yet there are more handy aliases in be.* and have.* namespaces:
await browser.all('.google-result').should(have.size(10))
All conditions (Condition) are just predicate-like functions on entity of corresponding type (T),
wrapped into Condition object: new Condition(description, predicateLikeFn)
The "predicate-like" function should:
- pass (returning void) in case when a "normal predicate" version would return true
- throw Error in case when a "normal predicate" would return false
The following example shows how a condition can be implemented:
export function hasText(expected: string): ElementCondition {
return new Condition(`has text: ${expected}`, async (element: Element) => {
const actual = await element.getWebElement().then(it => it.getText());
if (!actual.includes(expected)) {
throw new Error(`actual text: ${actual}`);
}
})
}
Or more concise by using arrow functions:
export const hasText = (expected: string): ElementCondition =>
new Condition(`has text: ${expected}`, async (element: Element) => {
const actual = await element.getWebElement().then(it => it.getText());
if (!actual.includes(expected)) {
throw new Error(`actual text: ${actual}`);
}
});
We can refactor the code above even more, if notice, that the actual condition reflects a simple rule:
- throw error if actual value (returned from some query on element like "getting its text") does not satisfy the predicate (like includes expected text) If we abstract this "throw error if not predicate(actual)" into some function like throwIfNotActual, The code will become very concise and declarative:
export const hasText = (expected: string): ElementCondition =>
new Condition(`has text: ${expected}`,
throwIfNotActual(query.text, predicate.includes(expected)));
This is how predefined in selenidejs conditions are implemented below.
Have fun;)
• browser:
Defined in lib/conditions.ts:242
▸ hasJsReturned(expected
: any, script
: string | function, ...args
: any[]): BrowserCondition
Defined in lib/conditions.ts:279
Parameters:
Name | Type |
---|---|
expected |
any |
script |
string | function |
...args |
any[] |
Returns: BrowserCondition
▸ hasTabsNumber(num
: number): BrowserCondition
Defined in lib/conditions.ts:264
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ hasTabsNumberLessThan(num
: number): BrowserCondition
Defined in lib/conditions.ts:274
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ hasTabsNumberMoreThan(num
: number): BrowserCondition
Defined in lib/conditions.ts:269
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ hasTitle(title
: string): BrowserCondition
Defined in lib/conditions.ts:254
Parameters:
Name | Type |
---|---|
title |
string |
Returns: BrowserCondition
▸ hasTitleContaining(partialTitle
: string): BrowserCondition
Defined in lib/conditions.ts:259
Parameters:
Name | Type |
---|---|
partialTitle |
string |
Returns: BrowserCondition
▸ hasUrl(url
: string): BrowserCondition
Defined in lib/conditions.ts:249
Parameters:
Name | Type |
---|---|
url |
string |
Returns: BrowserCondition
▸ hasUrlContaining(partialUrl
: string): BrowserCondition
Defined in lib/conditions.ts:244
Parameters:
Name | Type |
---|---|
partialUrl |
string |
Returns: BrowserCondition
• collection:
Defined in lib/conditions.ts:201
▸ hasExactTexts(texts
: string[] | number[]): CollectionCondition
Defined in lib/conditions.ts:236
Parameters:
Name | Type |
---|---|
texts |
string[] | number[] |
Returns: CollectionCondition
▸ hasSize(expected
: number): CollectionCondition
Defined in lib/conditions.ts:202
Parameters:
Name | Type |
---|---|
expected |
number |
Returns: CollectionCondition
▸ hasSizeGreaterThan(size
: number): CollectionCondition
Defined in lib/conditions.ts:207
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ hasSizeGreaterThanOrEqual(size
: number): CollectionCondition
Defined in lib/conditions.ts:212
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ hasSizeLessThan(size
: number): CollectionCondition
Defined in lib/conditions.ts:217
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ hasSizeLessThanOrEqual(size
: number): CollectionCondition
Defined in lib/conditions.ts:222
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ hasTexts(texts
: string[] | number[]): CollectionCondition
Defined in lib/conditions.ts:231
Parameters:
Name | Type |
---|---|
texts |
string[] | number[] |
Returns: CollectionCondition
• element:
Defined in lib/conditions.ts:122
• isAbsent: Condition‹unknown› = Condition.not(isPresent, 'is absent')
Defined in lib/conditions.ts:150
• isBlank: any = hasExactText('').and(hasValue(''))
Defined in lib/conditions.ts:198
• isDisabled: Condition‹unknown› = Condition.not(isEnabled, 'is disabled')
Defined in lib/conditions.ts:143
• isEnabled: Condition‹unknown› = new Condition( 'is enabled', throwIfNot(async (element: Element) => element.getWebElement().then(webelement => webelement.isEnabled())) )
Defined in lib/conditions.ts:138
• isFocused: Condition‹unknown› = new Condition( 'is focused', throwIfNot(async (element: Element) => WebElement.equals( await element.executeScript('return document.activeElement') as WebElement, await element.getWebElement() )) )
Defined in lib/conditions.ts:152
Const
isHidden
• isHidden: Condition‹unknown› = Condition.not(isVisible, 'is hidden')
Defined in lib/conditions.ts:129
• isPresent: Condition‹unknown› = new Condition( 'is present', throwIfNot(async (element: Element) => element.getWebElement().then(_ => true, _ => false) ))
Defined in lib/conditions.ts:145
• isSelected: Condition‹unknown› = hasAttribute('elementIsSelected')
Defined in lib/conditions.ts:136
• isVisible: Condition‹unknown› = new Condition( 'is visible', throwIfNot(async (element: Element) => element.getWebElement().then(webelement => webelement.isDisplayed())) )
Defined in lib/conditions.ts:124
▸ hasAttribute(name
: string): Condition‹unknown›
Defined in lib/conditions.ts:131
Parameters:
Name | Type |
---|---|
name |
string |
Returns: Condition‹unknown›
▸ hasAttributeWithValue(name
: string, value
: string | number): Condition‹unknown›
Defined in lib/conditions.ts:174
Parameters:
Name | Type |
---|---|
name |
string |
value |
string | number |
Returns: Condition‹unknown›
▸ hasAttributeWithValueContaining(name
: string, partialValue
: string | number): Condition‹unknown›
Defined in lib/conditions.ts:180
Parameters:
Name | Type |
---|---|
name |
string |
partialValue |
string | number |
Returns: Condition‹unknown›
▸ hasCssClass(cssClass
: string): Condition‹unknown›
Defined in lib/conditions.ts:185
Parameters:
Name | Type |
---|---|
cssClass |
string |
Returns: Condition‹unknown›
▸ hasExactText(expected
: string | number): Condition‹unknown›
Defined in lib/conditions.ts:170
Parameters:
Name | Type |
---|---|
expected |
string | number |
Returns: Condition‹unknown›
▸ hasText(expected
: string | number | RegExp): Condition‹unknown›
Defined in lib/conditions.ts:161
Parameters:
Name | Type |
---|---|
expected |
string | number | RegExp |
Returns: Condition‹unknown›
▸ hasValue(expected
: string | number): Condition‹unknown›
Defined in lib/conditions.ts:190
Parameters:
Name | Type |
---|---|
expected |
string | number |
Returns: Condition‹unknown›
▸ hasValueContaining(expected
: string | number): Condition‹unknown›
Defined in lib/conditions.ts:193
Parameters:
Name | Type |
---|---|
expected |
string | number |
Returns: Condition‹unknown›
▸ throwIfNot<E>(predicate
: function): Lambda‹E, void›
Defined in lib/conditions.ts:97
Creates condition from async query
Type parameters:
▪ E
Parameters:
▪ predicate: function
▸ (entity
: E): Promise‹boolean›
Parameters:
Name | Type |
---|---|
entity |
E |
Returns: Lambda‹E, void›
▸ throwIfNotActual<E, A>(query
: function, predicate
: function): Lambda‹E, void›
Defined in lib/conditions.ts:109
Transforms an entity query compared through predicate - to Condition Example: throwIfNotActual(query.text, predicate.equals(text))
Type parameters:
▪ E
▪ A
Parameters:
▪ query: function
▸ (entity
: E): Promise‹A›
Parameters:
Name | Type |
---|---|
entity |
E |
▪ predicate: function
▸ (actual
: A): boolean
Parameters:
Name | Type |
---|---|
actual |
A |
Returns: Lambda‹E, void›
• find:
Defined in lib/support/elements/find.ts:21
▸ alert(browser
: Browser): AlertPromise‹›
Defined in lib/support/elements/find.ts:51
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: AlertPromise‹›
▸ collected(searchFunction
: function): (Anonymous function)
Defined in lib/support/elements/find.ts:28
Parameters:
▪ searchFunction: function
▸ (element
: Element): Element | Collection
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: (Anonymous function)
▸ element(cssOrXpathOrBy
: string | By): (Anonymous function)
Defined in lib/support/elements/find.ts:25
Parameters:
Name | Type |
---|---|
cssOrXpathOrBy |
string | By |
Returns: (Anonymous function)
▸ elementAt(index
: number): (Anonymous function)
Defined in lib/support/elements/find.ts:37
Parameters:
Name | Type |
---|---|
index |
number |
Returns: (Anonymous function)
▸ elementBy(condition
: ElementCondition): (Anonymous function)
Defined in lib/support/elements/find.ts:45
Parameters:
Name | Type |
---|---|
condition |
ElementCondition |
Returns: (Anonymous function)
▸ filteredBy(condition
: ElementCondition): (Anonymous function)
Defined in lib/support/elements/find.ts:47
Parameters:
Name | Type |
---|---|
condition |
ElementCondition |
Returns: (Anonymous function)
▸ first(collection
: Collection): Element‹›
Defined in lib/support/elements/find.ts:40
Parameters:
Name | Type |
---|---|
collection |
Collection |
Returns: Element‹›
▸ followingSibling(element
: Element): Element‹›
Defined in lib/support/elements/find.ts:33
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Element‹›
▸ parent(element
: Element): Element‹›
Defined in lib/support/elements/find.ts:32
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Element‹›
▸ sliced(start
: number, end
: number): (Anonymous function)
Defined in lib/support/elements/find.ts:41
Parameters:
Name | Type |
---|---|
start |
number |
end |
number |
Returns: (Anonymous function)
• get:
Defined in lib/support/queries/get.ts:25
to be used in the following context:
element.click().then(get.text)
• currentTab: (Anonymous function) = waitingForBrowser(query.currentTab)
Defined in lib/support/queries/get.ts:56
• innerHtml: (Anonymous function) = waitingForEntity(query.innerHtml)
Defined in lib/support/queries/get.ts:35
• outerHtml: (Anonymous function) = waitingForEntity(query.outerHtml)
Defined in lib/support/queries/get.ts:36
• pageSource: (Anonymous function) = waitingForBrowser(query.pageSource)
Defined in lib/support/queries/get.ts:58
• size: (Anonymous function) = waitingForCollection(query.size)
Defined in lib/support/queries/get.ts:44
• someText: (Anonymous function) = waitingForEntity(query.someText)
Defined in lib/support/queries/get.ts:33
• tabs: (Anonymous function) = waitingForBrowser(query.tabs)
Defined in lib/support/queries/get.ts:54
• tabsNumber: (Anonymous function) = waitingForBrowser(query.tabsNumber)
Defined in lib/support/queries/get.ts:57
• text: (Anonymous function) = waitingForEntity(query.text)
Defined in lib/support/queries/get.ts:32
• texts: (Anonymous function) = waitingForCollection(query.texts)
Defined in lib/support/queries/get.ts:45
• title: (Anonymous function) = waitingForBrowser(query.title)
Defined in lib/support/queries/get.ts:53
• url: (Anonymous function) = waitingForBrowser(query.url)
Defined in lib/support/queries/get.ts:52
• value: (Anonymous function) = waitingForEntity(query.value)
Defined in lib/support/queries/get.ts:37
▸ attribute(name
: string): (Anonymous function)
Defined in lib/support/queries/get.ts:34
Parameters:
Name | Type |
---|---|
name |
string |
Returns: (Anonymous function)
▸ tab(index
: number): (Anonymous function)
Defined in lib/support/queries/get.ts:55
Parameters:
Name | Type |
---|---|
index |
number |
Returns: (Anonymous function)
▸ waitingForBrowser<R>(query
: Lambda‹Browser, R›): (Anonymous function)
Defined in lib/support/queries/get.ts:49
Type parameters:
▪ R
Parameters:
Name | Type |
---|---|
query |
Lambda‹Browser, R› |
Returns: (Anonymous function)
▸ waitingForCollection<R>(query
: Lambda‹Collection, R›): (Anonymous function)
Defined in lib/support/queries/get.ts:41
Type parameters:
▪ R
Parameters:
Name | Type |
---|---|
query |
Lambda‹Collection, R› |
Returns: (Anonymous function)
▸ waitingForEntity<R>(query
: Lambda‹Element, R›): (Anonymous function)
Defined in lib/support/queries/get.ts:29
Type parameters:
▪ R
Parameters:
Name | Type |
---|---|
query |
Lambda‹Element, R› |
Returns: (Anonymous function)
• have:
Defined in lib/support/conditions/have.ts:18
• no: have = new Proxy(have, { get: (have, conditionName) => (...args) => Condition.not(haveconditionName) })
Defined in lib/support/conditions/have.ts:20
▸ attribute(name
: string): ElementCondition
Defined in lib/support/conditions/have.ts:32
Parameters:
Name | Type |
---|---|
name |
string |
Returns: ElementCondition
▸ attributeWithValue(attributeName
: string, attributeValue
: string | number): ElementCondition
Defined in lib/support/conditions/have.ts:35
Parameters:
Name | Type |
---|---|
attributeName |
string |
attributeValue |
string | number |
Returns: ElementCondition
▸ attributeWithValueContaining(attributeName
: string, attributeValue
: string | number): ElementCondition
Defined in lib/support/conditions/have.ts:38
Parameters:
Name | Type |
---|---|
attributeName |
string |
attributeValue |
string | number |
Returns: ElementCondition
▸ cssClass(cssClass
: string): ElementCondition
Defined in lib/support/conditions/have.ts:48
Parameters:
Name | Type |
---|---|
cssClass |
string |
Returns: ElementCondition
▸ exactText(value
: string | number): ElementCondition
Defined in lib/support/conditions/have.ts:26
Parameters:
Name | Type |
---|---|
value |
string | number |
Returns: ElementCondition
▸ exactTexts(...texts
: string[]): CollectionCondition
Defined in lib/support/conditions/have.ts:68
Parameters:
Name | Type |
---|---|
...texts |
string[] |
Returns: CollectionCondition
▸ jsReturned(expected
: any, script
: string, ...scriptArgs
: any[]): BrowserCondition
Defined in lib/support/conditions/have.ts:96
Parameters:
Name | Type |
---|---|
expected |
any |
script |
string |
...scriptArgs |
any[] |
Returns: BrowserCondition
▸ size(size
: number): CollectionCondition
Defined in lib/support/conditions/have.ts:53
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ sizeGreaterThan(size
: number): CollectionCondition
Defined in lib/support/conditions/have.ts:59
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ sizeGreaterThanOrEqual(size
: number): CollectionCondition
Defined in lib/support/conditions/have.ts:61
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ sizeLessThan(size
: number): CollectionCondition
Defined in lib/support/conditions/have.ts:55
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ sizeLessThanOrEqual(size
: number): CollectionCondition
Defined in lib/support/conditions/have.ts:57
Parameters:
Name | Type |
---|---|
size |
number |
Returns: CollectionCondition
▸ tabsNumber(num
: number): BrowserCondition
Defined in lib/support/conditions/have.ts:85
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ tabsNumberLessThan(num
: number): BrowserCondition
Defined in lib/support/conditions/have.ts:88
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ tabsNumberMoreThan(num
: number): BrowserCondition
Defined in lib/support/conditions/have.ts:91
Parameters:
Name | Type |
---|---|
num |
number |
Returns: BrowserCondition
▸ text(value
: string | number | RegExp): ElementCondition
Defined in lib/support/conditions/have.ts:29
Parameters:
Name | Type |
---|---|
value |
string | number | RegExp |
Returns: ElementCondition
▸ texts(...texts
: string[]): CollectionCondition
Defined in lib/support/conditions/have.ts:65
Parameters:
Name | Type |
---|---|
...texts |
string[] |
Returns: CollectionCondition
▸ title(expected
: string): BrowserCondition
Defined in lib/support/conditions/have.ts:79
Parameters:
Name | Type |
---|---|
expected |
string |
Returns: BrowserCondition
▸ titleContaining(titlePart
: string): BrowserCondition
Defined in lib/support/conditions/have.ts:82
Parameters:
Name | Type |
---|---|
titlePart |
string |
Returns: BrowserCondition
▸ url(url
: string): BrowserCondition
Defined in lib/support/conditions/have.ts:71
Parameters:
Name | Type |
---|---|
url |
string |
Returns: BrowserCondition
▸ urlContaining(urlPart
: string): BrowserCondition
Defined in lib/support/conditions/have.ts:76
Parameters:
Name | Type |
---|---|
urlPart |
string |
Returns: BrowserCondition
▸ value(value
: string | number): ElementCondition
Defined in lib/support/conditions/have.ts:42
Parameters:
Name | Type |
---|---|
value |
string | number |
Returns: ElementCondition
▸ valueContaining(expected
: string | number): ElementCondition
Defined in lib/support/conditions/have.ts:45
Parameters:
Name | Type |
---|---|
expected |
string | number |
Returns: ElementCondition
• perform:
Defined in lib/support/commands/perform.ts:26
• js:
Defined in lib/support/commands/perform.ts:45
▸ click(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:47
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ clickWithOffset(xOffset
: number, yOffset
: number): (Anonymous function)
Defined in lib/support/commands/perform.ts:49
Parameters:
Name | Type |
---|---|
xOffset |
number |
yOffset |
number |
Returns: (Anonymous function)
▸ scrollIntoView(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:58
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ setValue(value
: string | number): (Anonymous function)
Defined in lib/support/commands/perform.ts:52
Parameters:
Name | Type |
---|---|
value |
string | number |
Returns: (Anonymous function)
▸ type(keys
: string | number): (Anonymous function)
Defined in lib/support/commands/perform.ts:55
Parameters:
Name | Type |
---|---|
keys |
string | number |
Returns: (Anonymous function)
▸ back(browser
: Browser): Promise‹void›
Defined in lib/support/commands/perform.ts:83
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹void›
▸ clear(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:35
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ clearCookies(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:95
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ clearLocalStorage(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:93
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ clearSessionStorage(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:94
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ click(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:30
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ closeCurrentTab(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:81
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ contextClick(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:32
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ doubleClick(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:31
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ executeScript(script
: string | function, ...args
: any[]): (Anonymous function)
Defined in lib/support/commands/perform.ts:98
Parameters:
Name | Type |
---|---|
script |
string | function |
...args |
any[] |
Returns: (Anonymous function)
▸ forward(browser
: Browser): Promise‹void›
Defined in lib/support/commands/perform.ts:84
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹void›
▸ goToNextTab(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:86
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ goToPreviousTab(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:87
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ goToTab(indexOrId
: number | string): (Anonymous function)
Defined in lib/support/commands/perform.ts:88
Parameters:
Name | Type |
---|---|
indexOrId |
number | string |
Returns: (Anonymous function)
▸ hover(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:33
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ open(url
: string): (Anonymous function)
Defined in lib/support/commands/perform.ts:77
Parameters:
Name | Type |
---|---|
url |
string |
Returns: (Anonymous function)
▸ pressEnter(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:39
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ pressEscape(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:41
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ pressTab(element
: Element): Promise‹Element‹››
Defined in lib/support/commands/perform.ts:40
Parameters:
Name | Type |
---|---|
element |
Element |
Returns: Promise‹Element‹››
▸ quit(browser
: Browser): Promise‹void›
Defined in lib/support/commands/perform.ts:82
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹void›
▸ refresh(browser
: Browser): Promise‹void›
Defined in lib/support/commands/perform.ts:85
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹void›
▸ resizeWindow(width
: any, height
: any): (Anonymous function)
Defined in lib/support/commands/perform.ts:78
Parameters:
Name | Type |
---|---|
width |
any |
height |
any |
Returns: (Anonymous function)
▸ screenshot(browser
: Browser): Promise‹Buffer›
Defined in lib/support/commands/perform.ts:80
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Buffer›
▸ setValue(value
: string | number): (Anonymous function)
Defined in lib/support/commands/perform.ts:37
Parameters:
Name | Type |
---|---|
value |
string | number |
Returns: (Anonymous function)
▸ switchToDefaultFrame(browser
: Browser): Promise‹Browser‹››
Defined in lib/support/commands/perform.ts:91
Parameters:
Name | Type |
---|---|
browser |
Browser |
Returns: Promise‹Browser‹››
▸ type(keys
: string | number): (Anonymous function)
Defined in lib/support/commands/perform.ts:36
Parameters:
Name | Type |
---|---|
keys |
string | number |
Returns: (Anonymous function)
• predicate:
Defined in lib/utils/predicates.ts:16
• equalsByContainsToArray: (Anonymous function) = arrayCompareBy(includes)
Defined in lib/utils/predicates.ts:32
• equalsToArray: (Anonymous function) = arrayCompareBy(equals)
Defined in lib/utils/predicates.ts:31
▸ arrayCompareBy(f
: any): (Anonymous function)
Defined in lib/utils/predicates.ts:27
Parameters:
Name | Type |
---|---|
f |
any |
Returns: (Anonymous function)
▸ equals<V>(expected
: V): (Anonymous function)
Defined in lib/utils/predicates.ts:18
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
expected |
V |
Returns: (Anonymous function)
▸ includes(expected
: any): (Anonymous function)
Defined in lib/utils/predicates.ts:23
Parameters:
Name | Type |
---|---|
expected |
any |
Returns: (Anonymous function)
▸ includesWord(expected
: string): (Anonymous function)
Defined in lib/utils/predicates.ts:25
Parameters:
Name | Type |
---|---|
expected |
string |
Returns: (Anonymous function)
▸ isGreaterThan<V>(expected
: V): (Anonymous function)
Defined in lib/utils/predicates.ts:19
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
expected |
V |
Returns: (Anonymous function)
▸ isGreaterThanOrEqual<V>(expected
: V): (Anonymous function)
Defined in lib/utils/predicates.ts:20
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
expected |
V |
Returns: (Anonymous function)
▸ isLessThan<V>(expected
: V): (Anonymous function)
Defined in lib/utils/predicates.ts:21
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
expected |
V |
Returns: (Anonymous function)
▸ isLessThanOrEqual<V>(expected
: V): (Anonymous function)
Defined in lib/utils/predicates.ts:22
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
expected |
V |
Returns: (Anonymous function)
▸ isTruthy<V>(actual
: V): boolean
Defined in lib/utils/predicates.ts:17
Type parameters:
▪ V
Parameters:
Name | Type |
---|---|
actual |
V |
Returns: boolean
▸ matches(expected
: any): (Anonymous function)
Defined in lib/utils/predicates.ts:24
Parameters:
Name | Type |
---|---|
expected |
any |
Returns: (Anonymous function)
• query:
Defined in lib/queries.ts:48
Raw queries on actual element's webelement 'Raw' means - without any waiting...
All are implemented through element.getWebElement() e.g. element.getWebElement().getText over element.text() because element.text() already has waiting built in. this is needed, because these queries are used not only to build corresponding element methods with waiting built in but also for conditions...
Hence, these functions are not supposed to be used in "perform/get" context:
element.click().then(query.text)
this query may fail if element was absent after click for some milliseconds...
use the following alternative instead:
element.click().then(get.text)
Here, queries do not contain has* and is* queries, like hasText, or isVisible. User can use has* and is* conditions instead. Example: `if (element.matches(has.text('foo'))) { ... } We really don't need such has* or is* queries both here and built in the entity itself (like element.isVisible), because their use case is very rare. The user will mainly use steps (entity commands, like click) and assertions (entity should(condition)) in tests. And SelenideJs is a tests tool, not something else.
• currentTab: (Anonymous function) = lambda('current tab (window handle)', async (browser: Browser) => browser.driver.getWindowHandle())
Defined in lib/queries.ts:92
• innerHtml: (Anonymous function) = attribute('innerHTML')
Defined in lib/queries.ts:67
• nextTab: (Anonymous function) = lambda('next tab (window handle)', async (browser: Browser) => { const currentTab = await browser.driver.getWindowHandle(); const allTabs = await browser.driver.getAllWindowHandles(); const currentTabIndex = allTabs.indexOf(currentTab); return currentTabIndex >= allTabs.length ? allTabs[0] : allTabs[currentTabIndex + 1]; })
Defined in lib/queries.ts:98
• outerHtml: (Anonymous function) = attribute('outerHTML')
Defined in lib/queries.ts:69
• pageSource: (Anonymous function) = lambda('page source', async (browser: Browser) => browser.driver.getPageSource())
Defined in lib/queries.ts:118
• previousTab: (Anonymous function) = lambda('previous tab (window handle)', async (browser: Browser) => { const currentTab = await browser.driver.getWindowHandle(); const allTabs = await browser.driver.getAllWindowHandles(); const currentTabIndex = allTabs.indexOf(currentTab); return currentTabIndex > 0 ? allTabs[currentTabIndex - 1] : allTabs[allTabs.length - 1]; })
Defined in lib/queries.ts:105
• size: (Anonymous function) = lambda('size', async (collection: Collection) => (await collection.getWebElements()).length)
Defined in lib/queries.ts:76
• someText: (Anonymous function) = lambda('some nonempty visible text', async (element: Element) => { const text = await (await element.getWebElement()).getText(); if (!text) { throw new Error('there is no visible nonempty text'); } return text; })
Defined in lib/queries.ts:55
• tabs: (Anonymous function) = lambda('tabs (all window handles)', async (browser: Browser) => browser.driver.getAllWindowHandles())
Defined in lib/queries.ts:112
• tabsNumber: (Anonymous function) = lambda('tabs number', async (browser: Browser) => (await browser.driver.getAllWindowHandles()).length)
Defined in lib/queries.ts:115
• text: (Anonymous function) = lambda('text', async (element: Element) => (await element.getWebElement()).getText())
Defined in lib/queries.ts:52
• texts: (Anonymous function) = lambda('texts', async (collection: Collection) => { const webelements = await collection.getWebElements(); return Promise.all(webelements.map(webElement => webElement.getText())); })
Defined in lib/queries.ts:79
• title: (Anonymous function) = lambda('title', async (browser: Browser) => browser.driver.getTitle())
Defined in lib/queries.ts:89
• url: (Anonymous function) = lambda('url', async (browser: Browser) => browser.driver.getCurrentUrl())
Defined in lib/queries.ts:86
• value: (Anonymous function) = attribute('value')
Defined in lib/queries.ts:71
▸ attribute(name
: string): (Anonymous function)
Defined in lib/queries.ts:63
Parameters:
Name | Type |
---|---|
name |
string |
Returns: (Anonymous function)
▸ tab(index
: number): (Anonymous function)
Defined in lib/queries.ts:95
Parameters:
Name | Type |
---|---|
index |
number |
Returns: (Anonymous function)
• should:
Defined in lib/support/asserts/should.ts:18
▸ match<T>(condition
: Condition‹T›): (Anonymous function)
Defined in lib/support/asserts/should.ts:20
Type parameters:
▪ T: Assertable
Parameters:
Name | Type |
---|---|
condition |
Condition‹T› |
Returns: (Anonymous function)
Ƭ BrowserCondition: Condition‹Browser›
Defined in lib/conditions.ts:27
Ƭ CollectionCondition: Condition‹Collection›
Defined in lib/conditions.ts:26
Ƭ ElementCondition: Condition‹Element›
Defined in lib/conditions.ts:25
Ƭ Lambda: function
Defined in lib/wait.ts:24
Just a type alias to one-argument-async-function...
▸ (entity
: T): Promise‹R›
Parameters:
Name | Type |
---|---|
entity |
T |
Ƭ OnEntityFailureHook: OnFailureHook‹Browser | Element | Collection›
Defined in lib/configuration.ts:31
A one place to configure everything. There is no separate Browser, Element or Collection configurations. All corresponding options live here, in Configuration.* It was implemented like this to stay KISS and simplify implementation. Enjoy;)
Ƭ OnFailureHook: function
Defined in lib/wait.ts:198
▸ (failure
: Error, entity
: T): Promise‹void | Error›
Parameters:
Name | Type |
---|---|
failure |
Error |
entity |
T |
• isAbsoluteUrl: isAbsoluteUrl
Defined in lib/browser.ts:26
▸ lambda<F>(toString
: string, fn
: F): F
Defined in lib/utils/index.ts:17
Type parameters:
▪ F
Parameters:
Name | Type |
---|---|
toString |
string |
fn |
F |
Returns: F
▸ toString<O>(obj
: O): string
Defined in lib/utils/index.ts:22
Type parameters:
▪ O
Parameters:
Name | Type |
---|---|
obj |
O |
Returns: string