com.ibm.team.fvt.tests.web
Class WebSelectElement

java.lang.Object
  extended by com.ibm.team.fvt.tests.web.WebPageElement
      extended by com.ibm.team.fvt.tests.web.WebElementWrapper
          extended by com.ibm.team.fvt.tests.web.WebSelectElement

public class WebSelectElement
extends WebElementWrapper

Class to handle select element.

See Also:
Select

Constructor Summary
WebSelectElement(WebElementWrapper parent, org.openqa.selenium.By selectBy)
           
WebSelectElement(WebPage page, org.openqa.selenium.By selectBy)
           
WebSelectElement(WebPage page, WebBrowserElement element)
           
 
Method Summary
 void deselectAll()
          Clear all selected entries.
 java.util.List<WebBrowserElement> getAllElements()
          Return the select elements list.
 java.util.List<java.lang.String> getAllLabels()
          Return the select labels list.
 WebBrowserElement getOptionElement(java.lang.String option)
          Return the WebBrowserElement specified by the option label.
 WebBrowserElement getSelectedElement()
          Return the selected element.
 java.lang.String getText()
          Return the label of the selected option.
 boolean hasOption(java.lang.String option)
          Checks if a specific option is available for selection.
 void select(java.lang.String option)
          Select the corresponding option using the given text.
 void select(java.lang.String option, ByUtils.ComparisonPattern pattern)
          Select the corresponding option using the given text.
 void select(java.lang.String option, int pattern)
          Deprecated. Since 5.0.1. Use #select(String, ComparisonPattern) instead.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSelectElement

public WebSelectElement(WebElementWrapper parent,
                        org.openqa.selenium.By selectBy)

WebSelectElement

public WebSelectElement(WebPage page,
                        org.openqa.selenium.By selectBy)

WebSelectElement

public WebSelectElement(WebPage page,
                        WebBrowserElement element)
Method Detail

deselectAll

public void deselectAll()
Clear all selected entries. this is only valid when the SELECT supports multiple selections.


getAllElements

public java.util.List<WebBrowserElement> getAllElements()
Return the select elements list.

Returns:
The list of option as a List of WebBrowserElement.

getAllLabels

public java.util.List<java.lang.String> getAllLabels()
Return the select labels list.

Returns:
The list of option as a List of String.

getOptionElement

public WebBrowserElement getOptionElement(java.lang.String option)
Return the WebBrowserElement specified by the option label.

Parameters:
option - A String that represents the option to look for.
Returns:
A WebBrowserElement identified by the option label specified. Returns null if the element is not found.

getSelectedElement

public WebBrowserElement getSelectedElement()
Return the selected element.

Returns:
The first selected option as a WebBrowserElement.

getText

public java.lang.String getText()
Return the label of the selected option.

Overrides:
getText in class WebElementWrapper
Returns:
The selected option label as a String.

hasOption

public boolean hasOption(java.lang.String option)
Checks if a specific option is available for selection.

Parameters:
option - A String that represents the option to look for.
Returns:
True if the option is found; false otherwise.

select

public void select(java.lang.String option)
Select the corresponding option using the given text.

Parameters:
option - The option to select in the list.

select

public void select(java.lang.String option,
                   ByUtils.ComparisonPattern pattern)
Select the corresponding option using the given text.

Parameters:
option - The option to select in the list.
pattern - The pattern used for matching text.

select

@Deprecated
public void select(java.lang.String option,
                              int pattern)
Deprecated. Since 5.0.1. Use #select(String, ComparisonPattern) instead.

Select the corresponding option using the given text.

Parameters:
option - The option to select in the list.
pattern - The pattern used for matching text. Currently supported are:
  • #EQUALS_PATTERN
  • #STARTS_WITH_PATTERN
  • #ENDS_WITH_PATTERN
  • #CONTAINS_PATTERN