import { AnswersQuestions , MetaQuestion , Question , UsesAbilities } from '@serenity-js/core' ; import { formatted } from '@serenity-js/core/lib/io' ; import { ElementFinder } from 'protractor' ; import { BrowseTheWeb } from '../abilities' ; import { withAnswerOf } from '../withAnswerOf' ; import { TargetNestedElement } from './targets' ; desc Resolves to the value of a given [`input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
 *   WebElement , represented by  ElementFinder or `Question<ElementFinder>`.
 *
 *  extends serenity-js implements serenity-js export class Value extends Question < Promise < string > > implements MetaQuestion < Question < ElementFinder > | ElementFinder , Promise < string > > { param { Question < ElementFinder > | ElementFinder } target returns { Value } static of ( target ) { return new Value ( target ) ; } param { Question < ElementFinder > | ElementFinder } target constructor ( private readonly target ) { super ( formatted `the value of ${ target }` ) ; } desc Resolves to the value of a given [`input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
     *   WebElement , located in the context of a `parent` element.
     *
     *  param { Question < ElementFinder > | ElementFinder } parent returns { Question < Promise < string [ ] > > } see Target . all see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion} of ( parent ) { return new Value ( new TargetNestedElement ( parent , this . target ) ) ; } desc Makes the provided  {@link @serenity-js/core/lib/screenplay/actor~Actor} *  answer this  {@link @serenity-js/core/lib/screenplay~Question} .
     *
     *  param { AnswersQuestions & UsesAbilities } actor returns { Promise < void > } see {@link @serenity-js/core/lib/screenplay/actor~Actor} see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions} see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities} answeredBy ( actor ) { return withAnswerOf ( actor , this . target , ( elf ) => BrowseTheWeb . as ( actor ) . executeFunction ( function getValue ( webElement ) { return webElement . value ; } , elf . getWebElement ( ) ) ) ; } }