Class SelectBoxUtils

java.lang.Object
com.version1.webdriver.utils.TolerantInteraction
com.version1.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

    • SelectBoxUtils

      public SelectBoxUtils()
  • Method Details

    • itemByHtmlValueAttribute

      public static void itemByHtmlValueAttribute(org.openqa.selenium.WebElement selectBox, 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, 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, String htmlValue, int timeout) throws Throwable
      Parameters:
      webElement - active WebElement, already located
      htmlValue - HTML value attribute
      timeout - time in seconds to keep trying
      Throws:
      Throwable - any unhandled or un-tolerated exception
    • tolerantItemByHtmlValueAttribute

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

      public static void tolerantItemByVisibleText(org.openqa.selenium.WebElement webElement, String visibleText, int timeout) throws 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:
      Throwable - any unhandled or un-tolerated exception
    • tolerantItemByVisibleText

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

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

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

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