Class Actions.ClipboardAction

java.lang.Object
com.shaft.gui.element.internal.Actions.ClipboardAction
Enclosing class:
Actions

public class Actions.ClipboardAction extends Object
Provides keyboard-shortcut-based clipboard operations for a target element.

Each method selects all text in the element first (Ctrl+A) before performing the requested clipboard operation, then moves focus away (Arrow Right). Obtain an instance via Actions.clipboard():

driver.element().clipboard().copyAll(By.id("sourceField"))
      .and().clipboard().paste(By.id("destinationField"));
  • Method Summary

    Modifier and Type
    Method
    Description
    copyAll(@NonNull org.openqa.selenium.By locator)
    Selects all text inside the located element and copies it to the system clipboard (Ctrl+A, Ctrl+C).
    cutAll(@NonNull org.openqa.selenium.By locator)
    Selects all text inside the located element, cuts it to the system clipboard (Ctrl+A, Ctrl+X), and leaves the field empty.
    deleteAll(@NonNull org.openqa.selenium.By locator)
    Selects all text inside the located element and deletes it (Ctrl+A, Backspace).
    paste(@NonNull org.openqa.selenium.By locator)
    Pastes the current system clipboard contents into the located element (Ctrl+V).

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • deleteAll

      @Step("Delete text") public Actions deleteAll(@NonNull @NonNull org.openqa.selenium.By locator)
      Selects all text inside the located element and deletes it (Ctrl+A, Backspace).
      driver.element().clipboard().deleteAll(By.id("notes"));
      
      Parameters:
      locator - the locator for the target element whose text should be deleted
      Returns:
      the parent Actions instance for fluent chaining
    • copyAll

      @Step("Copy text to clipboard") public Actions copyAll(@NonNull @NonNull org.openqa.selenium.By locator)
      Selects all text inside the located element and copies it to the system clipboard (Ctrl+A, Ctrl+C).
      driver.element().clipboard().copyAll(By.id("output"));
      
      Parameters:
      locator - the locator for the target element whose text should be copied
      Returns:
      the parent Actions instance for fluent chaining
    • cutAll

      @Step("Cut text to clipboard") public Actions cutAll(@NonNull @NonNull org.openqa.selenium.By locator)
      Selects all text inside the located element, cuts it to the system clipboard (Ctrl+A, Ctrl+X), and leaves the field empty.
      Parameters:
      locator - the locator for the target element whose text should be cut
      Returns:
      the parent Actions instance for fluent chaining
    • paste

      @Step("Paste from clipboard") public Actions paste(@NonNull @NonNull org.openqa.selenium.By locator)
      Pastes the current system clipboard contents into the located element (Ctrl+V).
      driver.element().clipboard().copyAll(By.id("source"))
            .and().clipboard().paste(By.id("destination"));
      
      Parameters:
      locator - the locator for the target element that should receive the paste
      Returns:
      the parent Actions instance for fluent chaining