import {Value} from '@serenity-js/webdriverio/lib/screenplay/questions'
public class | source

Value

Returns the value attribute of a given WebElement, represented by Answerable<Element>

Extends:

Question → Value

Implements:

Examples:

Example widget
 <input type="text" id="username" value="Alice" />
Retrieve CSS classes of a given WebElement
 import { actorCalled } from '@serenity-js/core';
 import { Ensure, equals } from '@serenity-js/assertions';
 import { BrowseTheWeb, by, Value, Target } from '@serenity-js/webdriverio';

 const usernameField = () =>
     Target.the('username field').located(by.id('username'))

 actorCalled('Lisa')
     .whoCan(BrowseTheWeb.using(browser))
     .attemptsTo(
         Ensure.that(Value.of(usernameField), equals('Alice')),
     )

Static Method Summary

Static Public Methods
public static

of(element: Answerable<Element<'async'>>): Value

Constructor Summary

Public Constructor
public

constructor(element: Answerable<Element<'async'>>)

Method Summary

Public Methods
public

async answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<void>

Makes the provided Actor answer this Question.

public

of(parent: Answerable<Element<'async'>>): Question<Promise<string>>

Resolves to the value of a given input WebElement, located in the context of a parent element.

Static Public Methods

public static of(element: Answerable<Element<'async'>>): Value source

Params:

NameTypeAttributeDescription
element Answerable<Element<'async'>>

Returns:

Value

Public Constructors

public constructor(element: Answerable<Element<'async'>>) source

Params:

NameTypeAttributeDescription
element Answerable<Element<'async'>>

Public Methods

public async answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<void> source

Makes the provided Actor answer this Question.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<void>

public of(parent: Answerable<Element<'async'>>): Question<Promise<string>> source

Resolves to the value of a given input WebElement, located in the context of a parent element.

Params:

NameTypeAttributeDescription
parent Answerable<Element<'async'>>

Returns:

Question<Promise<string>>