@@ -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
@@ -1445,15 +1472,19 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
14451472Moves cursor to element matched by locator.
14461473Extra shift can be set with offsetX and offsetY options.
14471474
1475+ An optional ` context` (as a second parameter) can be specified to narrow the search to an element within a parent.
1476+ When the second argument is a non-number (string or locator object), it is treated as context.
1477+
14481478` ` ` js
14491479I .moveCursorTo (' .tooltip' );
14501480I .moveCursorTo (' #submit' , 5 ,5 );
1481+ I .moveCursorTo (' #submit' , ' .container' );
14511482` ` `
14521483
14531484#### Parameters
14541485
14551486* ` locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
1456- * ` offsetX` **[number][10]** (optional, ` 0 ` by default) X-axis offset.
1487+ * ` offsetX` **( [number][10] | [string][6] | [object][4]) ** (optional, ` 0 ` by default) X-axis offset or context locator .
14571488* ` offsetY` **[number][10]** (optional, ` 0 ` by default) Y-axis offset.
14581489
14591490Returns **void** automatically synchronized promise through #recorder
@@ -1877,17 +1908,22 @@ Returns **void** automatically synchronized promise through #recorder
18771908Checks that the given input field or textarea equals to given value.
18781909For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
18791910
1911+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
1912+
18801913` ` ` js
18811914I .seeInField (' Username' , ' davert' );
18821915I .seeInField ({css: ' form textarea' },' Type your comment here' );
18831916I .seeInField (' form input[type=hidden]' ,' hidden_value' );
18841917I .seeInField (' #searchform input' ,' Search' );
1918+ // within a context
1919+ I .seeInField (' Name' , ' John' , ' .form-container' );
18851920` ` `
18861921
18871922#### Parameters
18881923
18891924* ` field` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
18901925* ` value` **([string][6] | [object][4])** value to check.
1926+ * ` context` **([string][6]? | [object][4])** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
18911927
18921928Returns **void** automatically synchronized promise through #recorder
18931929
@@ -2052,7 +2088,7 @@ Selects an option in a drop-down select.
20522088Field is searched by label | name | CSS | XPath.
20532089Option is selected by visible text or by value.
20542090
2055- The third parameter is a context (CSS or XPath locator) to narrow the search.
2091+ The third parameter is an optional context (CSS or XPath locator) to narrow the search.
20562092
20572093` ` ` js
20582094I .selectOption (' Choose Plan' , ' Monthly' ); // select by label
@@ -2241,7 +2277,7 @@ Returns **void** automatically synchronized promise through #recorder
22412277Unselects a checkbox or radio button.
22422278Element is located by label or name or CSS or XPath.
22432279
2244- The second parameter is a context (CSS or XPath locator) to narrow the search.
2280+ The second parameter is an optional context (CSS or XPath locator) to narrow the search.
22452281
22462282` ` ` js
22472283I .uncheckOption (' #agree' );
0 commit comments