Select and Alerts
You can use several utility functions available for handling select html element and js
alert in a test.
#
Select html elementisMultiple(elemId)# tells whether given select element is a select element that support multiple selection
getOptions(elemId)# for the given select element returns a `list` having all option elements as elementIds
getAllSelectedOptions(elemId)# for the given select element returns a `list` having all selected option elements as elementIds# or empty list if no option is selected
getFirstSelectedOption(elemId)# for the given select element returns first selected option as elementId or throws an error# if nothing is selected
selectByVisibleText(elemId, text)# for the given select element, selects an option by the given text
selectByIndex(elemId, index)# for the given select element, selects an option by the given 0 based index
selectByValue(elemId, value)# for the given select element, selects an option by the given value
deselectAll(elemId)# Should only be used for multiple select element.# for the given select element, deselects all options
deselectByValue(elemId, value)# for the given select element, deselects option by given value
deselectByIndex(elemId, index)# for the given select element, deselects option by given index
deselectByVisibleText(elemId, text)# for the given select element, deselects option by given text
#
Js Alerts and PromptsacceptAlert() # presses the OK button on alert/confirm/prompt
dismissAlert() # presses the Cancel button on confirm/prompt
getAlertText() # returns the text shown in alert/confirm/prompt
sendAlertText(text) # types given text into the prompt