select method

Future<List<String>> select(
  1. String selector,
  2. List<String> values
)

Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error.

await page.select('select#colors', ['blue']); // single selection
await page
    .select('select#colors', ['red', 'green', 'blue']); // multiple selections

Shortcut for Page.mainFrame.select

Parameters:

  • selector: A selector to query page for
  • values: Values of options to select. If the <select> has the multiple attribute, all values are considered, otherwise only the first one is taken into account.

Returns an array of option values that have been successfully selected.

Implementation

Future<List<String>> select(String selector, List<String> values) {
  return mainFrame.select(selector, values);
}