Package uk.co.evoco.webdriver.utils
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 Summary
Constructors Constructor Description SelectBoxUtils()
-
Method Summary
Modifier and Type Method Description static voiditemByHtmlValueAttribute(org.openqa.selenium.WebElement selectBox, String htmlValue)Selects an option that has a matching value attribute in the Options tag markupstatic voiditemByIndex(org.openqa.selenium.WebElement selectBox, int index)Selects an option by the index of the option in the list.static voiditemByVisibleText(org.openqa.selenium.WebElement selectBox, String visibleText)Selects an option by the text that is visible in the select boxstatic voidtolerantItemByHtmlValueAttribute(org.openqa.selenium.WebElement webElement, String htmlValue)static voidtolerantItemByHtmlValueAttribute(org.openqa.selenium.WebElement webElement, String htmlValue, int timeout)static voidtolerantItemByIndex(org.openqa.selenium.WebElement webElement, int index)static voidtolerantItemByIndex(org.openqa.selenium.WebElement webElement, int index, int timeout)static voidtolerantItemByVisibleText(org.openqa.selenium.WebElement webElement, String visibleText)static voidtolerantItemByVisibleText(org.openqa.selenium.WebElement webElement, String visibleText, int timeout)-
Methods inherited from class uk.co.evoco.webdriver.utils.TolerantInteraction
tolerantInteraction, tolerantInteraction, tolerantInteraction
-
-
-
-
Method Detail
-
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 locatedhtmlValue- 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 locatedindex- 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 locatedvisibleText- 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 locatedhtmlValue- HTML value attributetimeout- 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 locatedhtmlValue- 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 locatedvisibleText- 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 locatedvisibleText- visible text in the select box (NOT the HTML value attribute)- Throws:
Throwable- any unhandled or un-tolerated exception
-
tolerantItemByIndex
public static void tolerantItemByIndex(org.openqa.selenium.WebElement webElement, int index, int timeout) throws Throwable- Parameters:
webElement- active WebElement, already locatedindex- index in order of displaytimeout- time in seconds to keep trying- Throws:
Throwable- any unhandled or un-tolerated exception
-
-