-
-
Notifications
You must be signed in to change notification settings - Fork 752
Expand file tree
/
Copy pathselectOption.mustache
More file actions
26 lines (22 loc) · 1.13 KB
/
selectOption.mustache
File metadata and controls
26 lines (22 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Selects an option in a drop-down select.
Field is searched by label | name | CSS | XPath.
Option is selected by visible text or by value.
The third parameter is an optional context (CSS or XPath locator) to narrow the search.
```js
I.selectOption('Choose Plan', 'Monthly'); // select by label
I.selectOption('subscription', 'Monthly'); // match option by text
I.selectOption('subscription', '0'); // or by value
I.selectOption('//form/select[@name=account]','Premium');
I.selectOption('form select[name=account]', 'Premium');
I.selectOption({css: 'form select[name=account]'}, 'Premium');
// within a context
I.selectOption('age', '21-60', '#section2');
```
Provide an array for the second argument to select multiple options.
```js
I.selectOption('Which OS do you use?', ['Android', 'iOS']);
```
@param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
@param {string|Array<*>} option visible text or value of option.
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
@returns {void} automatically synchronized promise through #recorder