Frame.select() 方法
在匹配 selector 的第一个 <select> 元素上选择一组值。
签名
class Frame {
select(selector: string, ...values: string[]): Promise<string[]>;
}
参数
|
参数 |
类型 |
说明 |
|---|---|---|
|
selector |
string |
要查询的选择器。 |
|
values |
string[] |
要选择的值数组。如果 |
返回值:
Promise<string[]>
成功选择的值列表。
异常
如果没有匹配 selector 的 <select>,则抛出错误。
示例
frame.select('select#colors', 'blue'); // single selection
frame.select('select#colors', 'red', 'green', 'blue'); // multiple selections