@@ -357,16 +357,21 @@ Returns **void** automatically synchronized promise through #recorder
357357Appends text to a input field or textarea.
358358Field is located by name, label, CSS or XPath
359359
360+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
361+
360362``` js
361363I .appendField (' #myTextField' , ' appended' );
362364// typing secret
363365I .appendField (' password' , secret (' 123456' ));
366+ // within a context
367+ I .appendField (' name' , ' John' , ' .form-container' );
364368```
365369
366370#### Parameters
367371
368372* ` field ` ** ([ string] [ 6 ] | [ object] [ 4 ] )** located by label|name|CSS|XPath|strict locator
369373* ` value ` ** [ string] [ 6 ] ** text value to append.
374+ * ` context ` ** ([ string] [ 6 ] ? | [ object] [ 4 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
370375
371376Returns ** void** automatically synchronized promise through #recorder
372377
@@ -382,15 +387,27 @@ Attaches a file to element located by label, name, CSS or XPath
382387Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
383388File will be uploaded to remote system (if tests are running remotely).
384389
390+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
391+
385392``` js
386393I .attachFile (' Avatar' , ' data/avatar.jpg' );
387394I .attachFile (' form input[name=avatar]' , ' data/avatar.jpg' );
395+ // within a context
396+ I .attachFile (' Avatar' , ' data/avatar.jpg' , ' .form-container' );
397+ ```
398+
399+ If the locator points to a non-file-input element (e.g., a dropzone area),
400+ the file will be dropped onto that element using drag-and-drop events.
401+
402+ ``` js
403+ I .attachFile (' #dropzone' , ' data/avatar.jpg' );
388404```
389405
390406#### Parameters
391407
392408* ` locator ` ** ([ string] [ 6 ] | [ object] [ 4 ] )** field located by label|name|CSS|XPath|strict locator.
393409* ` pathToFile ` ** [ string] [ 6 ] ** local file path relative to codecept.conf.ts or codecept.conf.js config file.
410+ * ` context ` ** ([ string] [ 6 ] ? | [ object] [ 4 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
394411
395412Returns ** void** automatically synchronized promise through #recorder
396413
@@ -428,7 +445,7 @@ Dismisses the active JavaScript popup, as created by window.alert|window.confirm
428445Selects a checkbox or radio button.
429446Element is located by label or name or CSS or XPath.
430447
431- The second parameter is a context (CSS or XPath locator) to narrow the search.
448+ The second parameter is an optional context (CSS or XPath locator) to narrow the search.
432449
433450``` js
434451I .checkOption (' #agree' );
@@ -462,15 +479,20 @@ I.clearCookie('test');
462479
463480Clears a ` <textarea> ` or text ` <input> ` element's value.
464481
482+ The second parameter is an optional context (CSS or XPath locator) to narrow the search.
483+
465484``` js
466485I .clearField (' Email' );
467486I .clearField (' user[email]' );
468487I .clearField (' #email' );
488+ // within a context
489+ I .clearField (' Email' , ' .form-container' );
469490```
470491
471492#### Parameters
472493
473494* ` field `   ;
495+ * ` context ` ** ([ string] [ 6 ] ? | [ object] [ 4 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
474496* ` editable ` ** ([ string] [ 6 ] | [ object] [ 4 ] )** field located by label|name|CSS|XPath|strict locator.
475497
476498Returns ** void** automatically synchronized promise through #recorder.
@@ -705,15 +727,20 @@ Returns **void** automatically synchronized promise through #recorder
705727Checks that value of input field or textarea doesn't equal to given value
706728Opposite to ` seeInField ` .
707729
730+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
731+
708732``` js
709733I .dontSeeInField (' email' , ' user@user.com' ); // field by name
710734I .dontSeeInField ({ css: ' form input.email' }, ' user@user.com' ); // field by CSS
735+ // within a context
736+ I .dontSeeInField (' Name' , ' old_value' , ' .form-container' );
711737```
712738
713739#### Parameters
714740
715741* ` field ` ** ([ string] [ 6 ] | [ object] [ 4 ] )** located by label|name|CSS|XPath|strict locator.
716742* ` value ` ** ([ string] [ 6 ] | [ object] [ 4 ] )** value to check.
743+ * ` context ` ** ([ string] [ 6 ] ? | [ object] [ 4 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
717744
718745Returns ** void** automatically synchronized promise through #recorder
719746
@@ -907,7 +934,7 @@ Returns **[Promise][11]<any>** script return value
907934Fills a text field or textarea, after clearing its value, with the given string.
908935Field is located by name, label, CSS, or XPath.
909936
910- The third parameter is a context (CSS or XPath locator) to narrow the search.
937+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
911938
912939` ` ` js
913940// by label
@@ -1877,17 +1904,22 @@ Returns **void** automatically synchronized promise through #recorder
18771904Checks that the given input field or textarea equals to given value.
18781905For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
18791906
1907+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
1908+
18801909` ` ` js
18811910I .seeInField (' Username' , ' davert' );
18821911I .seeInField ({css: ' form textarea' },' Type your comment here' );
18831912I .seeInField (' form input[type=hidden]' ,' hidden_value' );
18841913I .seeInField (' #searchform input' ,' Search' );
1914+ // within a context
1915+ I .seeInField (' Name' , ' John' , ' .form-container' );
18851916` ` `
18861917
18871918#### Parameters
18881919
18891920* ` field` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
18901921* ` value` **([string][6] | [object][4])** value to check.
1922+ * ` context` **([string][6]? | [object][4])** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
18911923
18921924Returns **void** automatically synchronized promise through #recorder
18931925
@@ -2052,7 +2084,7 @@ Selects an option in a drop-down select.
20522084Field is searched by label | name | CSS | XPath.
20532085Option is selected by visible text or by value.
20542086
2055- The third parameter is a context (CSS or XPath locator) to narrow the search.
2087+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
20562088
20572089` ` ` js
20582090I .selectOption (' Choose Plan' , ' Monthly' ); // select by label
@@ -2241,7 +2273,7 @@ Returns **void** automatically synchronized promise through #recorder
22412273Unselects a checkbox or radio button.
22422274Element is located by label or name or CSS or XPath.
22432275
2244- The second parameter is a context (CSS or XPath locator) to narrow the search.
2276+ The second parameter is an optional context (CSS or XPath locator) to narrow the search.
22452277
22462278` ` ` js
22472279I .uncheckOption (' #agree' );
0 commit comments