Skip to main content

externalClear

Instructs an actor who has the ability to BrowseTheWeb to clear the value of a form input field.

Example widget

<form>
<input type="text" name="example" id="example" />
</form>

Lean Page Object describing the widget

import { By, PageElement } from '@serenity-js/web'

const Form = {
exampleInput: () =>
PageElement.located(By.id('example'))
.describedAs('example input')
}

Clearing the value of an input field

import { actorCalled } from '@serenity-js/core'
import { Clear, Enter, Value } from '@serenity-js/web'
import { Ensure, equals } from '@serenity-js/assertions'

await actorCalled('Inés')
.whoCan(BrowseTheWeb.using(browser))
.attemptsTo(
Enter.theValue('Hello world!').into(Form.exampleInput()),
Ensure.that(Value.of(Form.exampleInput()), equals('Hello world!')),

Clear.theValueOf(Form.exampleInput()),
Ensure.that(Value.of(Form.exampleInput()), equals('')),
)

Learn more

Hierarchy

Index

Methods

staticexternaltheValueOf

externalinstantiationLocation

  • instantiationLocation(): FileSystemLocation
  • Returns the location where this Activity was instantiated.


    Returns FileSystemLocation

externaldescribedBy

  • Resolves the description of this object in the context of the provided actor.


    Parameters

    Returns Promise<string>

externaltoString

  • toString(): string
  • Returns a human-readable description of this object.


    Returns string

externalperformAs