Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Robotic Automation example: Selecting all entries in a list box that is on a webpage

Updated on September 10, 2021

The methods and properties for changing the selected entry on multiselect HTML list boxes only allow you to select one entry. There is no simple way to perform a Select All action.

To work around this limitation, use the ExecuteScript method off of the webpage. To do this, your list box must meet these requirements:

  • It must be an HTML Select element
  • It must have an ID

If you run the following script in an ExecuteScript method call, the system selects all of the list box items:

var listbox = document.getElementById("elementid");
var options = listbox.options;

for (var index = 0; index < options.length; index++)
{
    options[index].selected = true;
}
In the example script, replace elementid with the ID of your list box.

For more information on the ExecuteScript method, see Webpage properties, methods, and events.

  • Previous topic Robotic Automation example: Rewriting the HTML of a web control
  • Next topic Robotic Automation example: Shutting down emulator processes

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us