getRadioButtonSet
DataSet sutil.getRadioButtonSet ( String buttons, String buttonName, String ignoreLabel ) (professional and enterprise editions only)
DataSet sutil.getRadioButtonSet ( String buttons, String buttonName, Collection<String> ignoreLabels ) (professional and enterprise editions only)
DataSet sutil.getRadioButtonSet ( String buttons, String buttonName, Collection<String> ignoreLabels, boolean tidyRecords ) (professional and enterprise editions only)
Description
Gets all the options from a radio button group. The values are returned in a data record. Any labels that are to be ignored will not be included in the returned set. Not all buttons have a label, as radio buttons do not require a label, and it would be difficult to know in a regular expression exactly what to extract as the label unless there is a label tag.
Parameters
- buttons The text containing the buttons
- buttonName The name of the buttons that should be grabbed, as a Regex pattern
- ignoreLabels (or ignoreLabel) (optional) Any labels that should be excluded from the resulting set
- tidyRecords (optional) Should the TEXT be tidied before being stored in the resulting DataRecords
Return Value
DataSet containing one record for each of the extracted radio buttons. Values will be stored in
VALUE : The value the browser would submit for this radio button
TEXT : The text that represents this button, or null if no label could be found for it
SELECTED : A boolean that is true if this button was selected by default
ID : The ID of the radio button, or null if no ID was found
Change Log
Version | Description |
---|---|
5.5.29a | Available in all editions. |
Examples
Search each radio button from a radio button group
// Get all the radio buttons with the name attribute "selection"
DataSet items = sutil.getOptionSet(options, "selection");
for(int i = 0; i < items.getNumDataRecords(); i++)
{
DataRecord next = items.getDataRecord(i);
session.setVariable("BUTTON_VALUE", next.get("VALUE"));
session.log("Now scraping results for " + next.get("TEXT"));
session.scrapeFile("Search Results");
}
- Printer-friendly version
- Login or register to post comments