import {Enter} from '@serenity-js/protractor/lib/screenplay/interactions'
public class | source

Enter

Instructs the Actor to enter a value into a form input field.

Extends:

Interaction → Enter

Examples:

Example widget
 <form>
   <input type="text" name="example" id="example" />
 </form>
Lean Page Object describing the widget
 import { Target } from '@serenity-js/protractor';
 import { by } from 'protractor';

 class Form {
     static exampleInput = Target.the('example input')
         .located(by.id('example'));
 }
Enternig the value into a form field
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, Enter } from '@serenity-js/protractor';
 import { protractor } from 'protractor';

 actorCalled('Esme')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         Enter.theValue('Hello world!').into(Form.exampleInput),
     );

Tests:

See also:

Static Method Summary

Static Public Methods
public static

theValue(value: Question<ElementFinder> | ElementFinder): EnterBuilder

Instantiates this Interaction.

Constructor Summary

Public Constructor
public

constructor(value: Answerable<string|number>, field: Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise)

Method Summary

Public Methods
public

performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void>

Makes the provided Actor perform this Interaction.

public

toString(): string

Generates a description to be used when reporting this Activity.

Static Public Methods

public static theValue(value: Question<ElementFinder> | ElementFinder): EnterBuilder source

Instantiates this Interaction.

Params:

NameTypeAttributeDescription
value Question<ElementFinder> | ElementFinder

The value to be entered

Returns:

EnterBuilder

Public Constructors

public constructor(value: Answerable<string|number>, field: Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise) source

Params:

NameTypeAttributeDescription
value Answerable<string|number>

The value to be entered

field Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise

The field to enter the value into

Public Methods

public performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> source

Makes the provided Actor perform this Interaction.

Params:

NameTypeAttributeDescription
actor UsesAbilities & AnswersQuestions

An Actor to perform this Interaction

Returns:

PromiseLike<void>

public toString(): string source

Generates a description to be used when reporting this Activity.

Returns:

string