Class ClearWithShortcut

java.lang.Object
com.codeborne.selenide.FluentCommand
com.codeborne.selenide.commands.Clear
com.codeborne.selenide.clearwithshortcut.ClearWithShortcut
All Implemented Interfaces:
Command<SelenideElement>

public class ClearWithShortcut extends Clear
Clean the input field value.

The standard Selenium method WebElement.clear() does not help in case of "tricky" inputs generated by Vue.js, React and other fancy frameworks.


That's why we need to clear the field value by emulating real user actions:

  1. Select the whole text
  2. press "Delete"
  • Constructor Details

    • ClearWithShortcut

      public ClearWithShortcut()
  • Method Details

    • clear

      protected void clear(Driver driver, org.openqa.selenium.WebElement input)
      Clear the input content without triggering "change" and "blur" events
      Overrides:
      clear in class Clear
    • clearWithShortcut

      protected void clearWithShortcut(Driver driver, org.openqa.selenium.WebElement input)
    • getPlatform

      protected Platform getPlatform(Driver driver)