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 { ClientFunction, Selector } from 'testcafe';

const option = Selector('option');

const secondOption = option.nth(1);

const getSecondOptionHTML = ClientFunction(() => option().innerHTML, {
    dependencies: { option: secondOption },

const thirdOption = option.nth(2);

const getThirdOptionHTML = getSecondOptionHTML.with({
    dependencies: { option: thirdOption },