Class SendKey

All Implemented Interfaces:
Composable, MultiPhased

public class SendKey extends MultiPhaseAction
SendKey is a subclass of MultiPhaseAction which types into an element. StaleElementReferenceException may happen while Select tries to manipulate the element, so multi-phase is used to perform the action again.
Author:
Kimberly
  • Constructor Details

    • SendKey

      public SendKey(org.openqa.selenium.By by, boolean clearBeforeSend, CharSequence... keysToSend)
      Create an action to input keys to a specified element.
      Parameters:
      by - the element locating mechanism
      clearBeforeSend - true: clear before sending; false: send without clearing first
      keysToSend - character sequence to send to the element
    • SendKey

      public SendKey(org.openqa.selenium.By by, List<org.openqa.selenium.By> frameBySequence, boolean clearBeforeSend, CharSequence... keysToSend)
      Create an action to input keys to a specified element.
      Parameters:
      by - the element locating mechanism
      frameBySequence - the sequence of the frame locating mechanism for the element resides in frame(or frame in another frame and so on)
      clearBeforeSend - true: clear before sending; false: send without clearing first
      keysToSend - character sequence to send to the element
  • Method Details

    • clickToSendKeys

      public static void clickToSendKeys(org.openqa.selenium.WebElement element, boolean clearBeforeSend, CharSequence... keysToSend)
      Clicks an element and then types into it.
      Parameters:
      element - the element to send keys to
      clearBeforeSend - true: clear before sending; false: send without clearing first
      keysToSend - character sequence to send to the element
    • performMultiPhase

      protected void performMultiPhase()
      Description copied from class: MultiPhaseAction
      Perform multiple-phased browser action. MultiPhaseAction.noNextPhase() needs to be invoked to signal that there is no more phase to execute.
      Specified by:
      performMultiPhase in class MultiPhaseAction
    • toString

      public String toString()
      Overrides:
      toString in class MultiPhaseAction