Skip to content

Commit 933e69c

Browse files
DavertMikclaude
andcommitted
docs: add context parameter to appendField, attachFile, clearField docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 551ab94 commit 933e69c

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

docs/webapi/appendField.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
Appends text to a input field or textarea.
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
I.appendField('#myTextField', 'appended');
68
// typing secret
79
I.appendField('password', secret('123456'));
10+
// within a context
11+
I.appendField('name', 'John', '.form-container');
812
```
913
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1014
@param {string} value text value to append.
15+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1116
@returns {void} automatically synchronized promise through #recorder

docs/webapi/attachFile.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ Attaches a file to element located by label, name, CSS or XPath
22
Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
33
File will be uploaded to remote system (if tests are running remotely).
44

5+
The third parameter is a context (CSS or XPath locator) to narrow the search.
6+
57
```js
68
I.attachFile('Avatar', 'data/avatar.jpg');
79
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
10+
// within a context
11+
I.attachFile('Avatar', 'data/avatar.jpg', '.form-container');
812
```
913

1014
@param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1115
@param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
16+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1217
@returns {void} automatically synchronized promise through #recorder

docs/webapi/clearField.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
Clears a `<textarea>` or text `<input>` element's value.
22

3+
The second parameter is a context (CSS or XPath locator) to narrow the search.
4+
35
```js
46
I.clearField('Email');
57
I.clearField('user[email]');
68
I.clearField('#email');
9+
// within a context
10+
I.clearField('Email', '.form-container');
711
```
812
@param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
13+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
914
@returns {void} automatically synchronized promise through #recorder.

0 commit comments

Comments
 (0)