Skip to content

Commit 0f56d1f

Browse files
DavertMikclaude
andcommitted
docs: add context parameter to seeElement, dontSeeElement, fillField, selectOption
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1371552 commit 0f56d1f

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
22

3+
The second parameter is a context (CSS or XPath locator) to narrow the search.
4+
35
```js
46
I.dontSeeElement('.modal'); // modal is not shown
7+
I.dontSeeElement('.modal', '#container');
58
```
69

710
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
11+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
812
@returns {void} automatically synchronized promise through #recorder

docs/webapi/fillField.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Fills a text field or textarea, after clearing its value, with the given string.
22
Field is located by name, label, CSS, or XPath.
33

4+
The third parameter is a context (CSS or XPath locator) to narrow the search.
5+
46
```js
57
// by label
68
I.fillField('Email', 'hello@world.com');
@@ -10,7 +12,10 @@ I.fillField('password', secret('123456'));
1012
I.fillField('form#login input[name=username]', 'John');
1113
// or by strict locator
1214
I.fillField({css: 'form#login input[name=username]'}, 'John');
15+
// within a context
16+
I.fillField('Name', 'John', '#section2');
1317
```
1418
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1519
@param {CodeceptJS.StringOrSecret} value text value to fill.
20+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1621
@returns {void} automatically synchronized promise through #recorder

docs/webapi/seeElement.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
Checks that a given Element is visible
22
Element is located by CSS or XPath.
33

4+
The second parameter is a context (CSS or XPath locator) to narrow the search.
5+
46
```js
57
I.seeElement('#modal');
8+
I.seeElement('#modal', '#container');
69
```
710
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
11+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
812
@returns {void} automatically synchronized promise through #recorder

docs/webapi/selectOption.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ Selects an option in a drop-down select.
22
Field is searched by label | name | CSS | XPath.
33
Option is selected by visible text or by value.
44

5+
The third parameter is a context (CSS or XPath locator) to narrow the search.
6+
57
```js
68
I.selectOption('Choose Plan', 'Monthly'); // select by label
79
I.selectOption('subscription', 'Monthly'); // match option by text
810
I.selectOption('subscription', '0'); // or by value
911
I.selectOption('//form/select[@name=account]','Premium');
1012
I.selectOption('form select[name=account]', 'Premium');
1113
I.selectOption({css: 'form select[name=account]'}, 'Premium');
14+
// within a context
15+
I.selectOption('age', '21-60', '#section2');
1216
```
1317

1418
Provide an array for the second argument to select multiple options.
@@ -18,4 +22,5 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1822
```
1923
@param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
2024
@param {string|Array<*>} option visible text or value of option.
25+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
2126
@returns {void} automatically synchronized promise through #recorder

0 commit comments

Comments
 (0)