You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add context parameter to appendField, clearField, attachFile (#5479)
* feat: add context parameter to appendField, clearField, attachFile
Add optional context parameter to remaining form-filling methods
(appendField, clearField, attachFile) across Playwright, Puppeteer,
and WebDriver helpers for consistency with fillField, selectOption,
checkOption, and uncheckOption which already support it.
This allows scoping element search to a specific DOM container:
I.appendField('Name', 'jon', '.form-container')
I.clearField('Name', '.form-container')
I.attachFile('Avatar', 'data/avatar.jpg', '.form-container')
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for context parameter on appendField, clearField, attachFile
Add shared webapi tests verifying that context scoping works for
appendField, clearField, and attachFile. Extended the context.php
test page with pre-filled values and file inputs to support the tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: simplify Playwright clearField signature to match other helpers
Remove unused `options` parameter from Playwright's clearField. The
options were accepted but never passed to the underlying clear() call.
Now all helpers have consistent `clearField(locator, context)` signature.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add context parameter to appendField, attachFile, clearField docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: clarify context parameter is optional in all form method docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add context parameter to seeInField and dontSeeInField
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: pass context string (not locateFn) to findFields in WebDriver proceedSeeField
proceedSeeField was double-wrapping context through prepareLocateFn before
passing to findFields, which already handles context internally. This caused
"locator.replace is not a function" errors in 37 WebDriver tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: DavertMik <davert@testomat.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: lib/helper/Playwright.js
+13-27Lines changed: 13 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -2278,24 +2278,10 @@ class Playwright extends Helper {
2278
2278
}
2279
2279
2280
2280
/**
2281
-
* Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
2282
-
*
2283
-
*
2284
-
* Examples:
2285
-
*
2286
-
* ```js
2287
-
* I.clearField('.text-area')
2288
-
*
2289
-
* // if this doesn't work use force option
2290
-
* I.clearField('#submit', { force: true })
2291
-
* ```
2292
-
* Use `force` to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
2293
-
*
2294
-
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
2295
-
* @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-locator#locator-clear) for available options object as 2nd argument.
0 commit comments