Select commands are used to choose an option from drop-down boxes using the visible Text of the elements.
Goal: To Select an option using drop-down's ID attribute.
Parameters:
- ID: the HTML element ID of the drop-down control.
- Text: the visible text of the option to choose.
Example of use:
&driver.SelectById("Country", "England")
Goal: To Select an option using drop-down's 'name' attribute.
Parameters:
- Name: the 'name' attribute of the drop-down control.
- Text: the visible text of the option to choose.
Example of use:
&driver.SelectByName("City", "London")
Goal: To Select an option from a drop-down using a CSS selector.
Parameters:
- CSS: the CSS selector to the drop-down that you want to Select.
- Text: the visible text of the option to choose.
Example of use:
&driver.SelectByCSS("#currency", "US Dollars")
Goal: To Select an option from a drop-down using an XPath selector.
Parameters:
- XPath: the XPath selector to the drop-down item that you want to Select
- Text: the visible text of the option to choose
Example of use:
&driver.SelectByXPath("//select[@id='groupSelect']", "First Option")
|