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

DoubleClick

Instructs the Actor to perform a double-click on a given Web element.

Extends:

Interaction → DoubleClick

Examples:

Example widget
 <!--
     The editor shows up when the user double-clicks
     on one of the properties of their profile
     and let's them change the value of that property.
 -->
 <div id="user-profile">
     <ul>
         <li id="display-name" ondblclick="edit(this)">User12345</li>
         <li id="email-address" ondblclick="edit(this)">tester@example.org</li>
     </ul>
     <form id="editor" class="hidden">
         <input type="text" value="" />
     </form>
 </div>
Lean Page Object describing the widget
 import { Target } from '@serenity-js/protractor';
 import { by } from 'protractor';

 class UserProfile {
     static displayName = Target.the('display name')
         .located(by.id('display-name'));
     static emailAddress = Target.the('email address')
         .located(by.id('email-address'));
     static editor = Target.the('editor')
         .located(by.id('editor'));
 }
Double-clicking on an element
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, DoubleClick, isVisible, Enter, Text, Wait } from '@serenity-js/protractor';
 import { Ensure, equals, not } from '@serenity-js/assertions';
 import { protractor, Key } from 'protractor';

 actorCalled('Dorothy')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         DoubleClick.on(UserProfile.displayName),
         Wait.until(UserProfile.editor, isVisible()),

         Enter.theValue('New username').into(UserProfile.editor),
         Press.the(Key.ENTER).in(UserProfile.editor),

         Ensure.that(Text.of(UserProfile.displayName), equals('New username')),
         Ensure.that(UserProfile.editor, not(isVisible()))
     );

See also:

Static Method Summary

Static Public Methods
public static

on(target: Question<ElementFinder> | ElementFinder): Interaction

Instantiates this Interaction.

Constructor Summary

Public Constructor
public

constructor(target: Question<ElementFinder> | ElementFinder)

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 on(target: Question<ElementFinder> | ElementFinder): Interaction source

Instantiates this Interaction.

Params:

NameTypeAttributeDescription
target Question<ElementFinder> | ElementFinder

The element to be double-clicked on

Returns:

Interaction

Public Constructors

public constructor(target: Question<ElementFinder> | ElementFinder) source

Params:

NameTypeAttributeDescription
target Question<ElementFinder> | ElementFinder

The element to be double-clicked on

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