Documentation
REFERENCE
ClientFunction.with Method
Overwrites client function options.
clientFunction.with(options) → ClientFunction
with
returns a new client function with a different set of options. This includes options from the original function and new options
that overwrite them.
The sample below shows how to overwrite client function options.
import { Selector, ClientFunction } from 'testcafe';
const option = Selector('option');
const thirdOption = option.nth(2);
const getThirdOptionHTML = ClientFunction(() => option().innerHTML, {
dependencies: { option: thirdOption }
});
const fourthOption = option.nth(3);
const getFourthOptionHTML = getThirdOptionHTML.with({
dependencies: { option: fourthOption }
});