java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.DeselectFromOptions

public class DeselectFromOptions extends Object
Deselect options from a multi-select dropdown by text, value or index. This is the inverse of SelectFromOptions for multi-select elements.

Sample usage:

     // Deselect by value
     actor.attemptsTo(DeselectFromOptions.byValue("option1", "option2").from("#multi-select"));

     // Deselect by visible text
     actor.attemptsTo(DeselectFromOptions.byVisibleText("Option Label").from(DROPDOWN));

     // Deselect by index
     actor.attemptsTo(DeselectFromOptions.byIndex(0).from("#multi-select"));

     // Deselect all options
     actor.attemptsTo(DeselectFromOptions.all().from("#multi-select"));
 
  • Constructor Details

    • DeselectFromOptions

      public DeselectFromOptions(net.serenitybdd.screenplay.playwright.interactions.DeselectStrategy strategy)
  • Method Details

    • byValue

      public static DeselectFromOptions byValue(String... values)
      Deselect options by their value attributes.
      Parameters:
      values - The values to deselect
      Returns:
      A DeselectFromOptions builder
    • byVisibleText

      public static DeselectFromOptions byVisibleText(String visibleText)
      Deselect an option by its visible text.
      Parameters:
      visibleText - The visible text of the option to deselect
      Returns:
      A DeselectFromOptions builder
    • byIndex

      public static DeselectFromOptions byIndex(int indexValue)
      Deselect an option by its index (0-based).
      Parameters:
      indexValue - The index of the option to deselect
      Returns:
      A DeselectFromOptions builder
    • all

      public static DeselectFromOptions.DeselectAll all()
      Deselect all currently selected options.
      Returns:
      A builder that will deselect all options
    • from

      public net.serenitybdd.screenplay.Performable from(String cssOrXpathForElement)
      Specify the dropdown to deselect from using a CSS or XPath selector.
      Parameters:
      cssOrXpathForElement - The selector for the dropdown
      Returns:
      A Performable that deselects the specified options
    • from

      public net.serenitybdd.screenplay.Performable from(Target target)
      Specify the dropdown to deselect from using a Target.
      Parameters:
      target - The Target for the dropdown
      Returns:
      A Performable that deselects the specified options