Hover
Instructs the Actor to hover the mouse pointer over a given Web element.
Extends:
Examples:
<a data-test="example-link"
class="off"
onmouseover="this.className='on';"
onmouseout="this.className='off';"
href="/">hover over me</a>
import { by, Target } from '@serenity-js/webdriverio';
class Example {
static link = Target.the('example link')
.located(by.css('[data-test="example-link"]'));
}
import { actorCalled } from '@serenity-js/core';
import { BrowseTheWeb, Hover, CSSClasses } from '@serenity-js/webdriverio';
import { Ensure, equals } from '@serenity-js/assertions';
actorCalled('Hank')
.whoCan(BrowseTheWeb.using(browser))
.attemptsTo(
Ensure.that(CSSClasses.of(Example.link), equals([ 'off' ])),
Hover.over(Example.link),
Ensure.that(CSSClasses.of(Example.link), equals([ 'on' ])),
);
Tests:
See also:
Static Method Summary
Static Public Methods | ||
public static |
over(target: Answerable<Element<'async'>>): Interaction Instantiates this Interaction. |
Constructor Summary
Public Constructor | ||
public |
constructor(target: Answerable<Element<'async'>>) |
Method Summary
Public Methods | ||
public |
async performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> Makes the provided Actor perform this Interaction. |
Inherited Summary
From class WebElementInteraction | ||
public |
toString(): string Generates a description to be used when reporting this Activity. |
|
protected |
async resolve(actor: AnswersQuestions, element: Answerable<Element<'async'>>): Promise<Element<'async'>> Returns the resolved Element, or throws a LogicError
if the element is |
Static Public Methods
public static over(target: Answerable<Element<'async'>>): Interaction source
Instantiates this Interaction.
Params:
Name | Type | Attribute | Description |
target | Answerable<Element<'async'>> | The element to be hovered over |
Public Constructors
public constructor(target: Answerable<Element<'async'>>) source
Override:
WebElementInteraction#constructorParams:
Name | Type | Attribute | Description |
target | Answerable<Element<'async'>> | The element to be hovered over |
Public Methods
public async performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> source
Makes the provided Actor perform this Interaction.
Params:
Name | Type | Attribute | Description |
actor | UsesAbilities & AnswersQuestions | An Actor to perform this Interaction |
Returns:
PromiseLike<void> |