Class SelectBoxUtils

java.lang.Object
uk.co.evoco.webdriver.utils.TolerantInteraction
uk.co.evoco.webdriver.utils.SelectBoxUtils

public final class SelectBoxUtils
extends TolerantInteraction
Utilities class providing support methods for Select Boxes While this is straight forward, its less than obvious to newcomers. Feel free not to use this at all and just do it with WebDriver!
  • Constructor Details

  • Method Details

    • itemByHtmlValueAttribute

      public static void itemByHtmlValueAttribute​(org.openqa.selenium.WebElement selectBox, java.lang.String htmlValue)
      Selects an option that has a matching value attribute in the Options tag markup
      Parameters:
      selectBox - active WebElement, already located
      htmlValue - HTML value attribute
    • itemByIndex

      public static void itemByIndex​(org.openqa.selenium.WebElement selectBox, int index)
      Selects an option by the index of the option in the list. The input is NOT zero based, we're normalising the input internally.
      Parameters:
      selectBox - active WebElement, already located
      index - index in order of display
    • itemByVisibleText

      public static void itemByVisibleText​(org.openqa.selenium.WebElement selectBox, java.lang.String visibleText)
      Selects an option by the text that is visible in the select box
      Parameters:
      selectBox - active WebElement, already located
      visibleText - visible text in the select box (NOT the HTML value attribute)
    • tolerantItemByHtmlValueAttribute

      public static void tolerantItemByHtmlValueAttribute​(org.openqa.selenium.WebElement webElement, java.lang.String htmlValue, int timeout) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      htmlValue - HTML value attribute
      timeout - time in seconds to keep trying
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception
    • tolerantItemByHtmlValueAttribute

      public static void tolerantItemByHtmlValueAttribute​(org.openqa.selenium.WebElement webElement, java.lang.String htmlValue) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      htmlValue - HTML value attribute
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception
    • tolerantItemByVisibleText

      public static void tolerantItemByVisibleText​(org.openqa.selenium.WebElement webElement, java.lang.String visibleText, int timeout) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      visibleText - visible text in the select box (NOT the HTML value attribute)
      timeout - time in seconds to keep trying
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception
    • tolerantItemByVisibleText

      public static void tolerantItemByVisibleText​(org.openqa.selenium.WebElement webElement, java.lang.String visibleText) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      visibleText - visible text in the select box (NOT the HTML value attribute)
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception
    • tolerantItemByVisibleText

      public static void tolerantItemByVisibleText​(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.By locator, java.lang.String visibleText) throws java.lang.Throwable
      Parameters:
      webDriver -
      locator -
      visibleText -
      Throws:
      java.lang.Throwable
    • tolerantItemByIndex

      public static void tolerantItemByIndex​(org.openqa.selenium.WebElement webElement, int index, int timeout) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      index - index in order of display
      timeout - time in seconds to keep trying
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception
    • tolerantItemByIndex

      public static void tolerantItemByIndex​(org.openqa.selenium.WebElement webElement, int index) throws java.lang.Throwable
      Parameters:
      webElement - active WebElement, already located
      index - index in order of display
      Throws:
      java.lang.Throwable - any unhandled or un-tolerated exception