• Get the key for the record filtered by filterDef. If exactly one record is found after filtering is applied, the key of that record is returned. An error is thrown if, after filtering:

    • no records are found
    • more than one record is found If the property identified by dataProviderProp doesn't exist or is not a DataProvider, an error will be also thrown.

    Type Parameters

    • E

      Custom element type

    • K

      Type of key value

    • DataProviderProps = AllowedNames<E, DataProvider<K, any>>

      Type representing DataProvider-valued properties of the custom element type

    Parameters

    • el: OjWebElement

      The OjWebElement whose properties reference the DataProvider

    • dataProviderProp: DataProviderProps

      The property name within the element identifying the DataProvider

    • filterDef: FilterDef<any>

      A FilterDef used to locate the record within the DataProvider

    Returns Promise<K>

    The key of the matching record

    Example Usage

    Fetch a key from a SelectSingle DataProvider by filtering for a DepartmentName

    import { fetchKeyByFilter } from '@oracle/oraclejet-webdriver';
    import { ojSelectSingle as JetSelectSingle } from '@oracle/oraclejet/ojselectsingle';

    const ss1 = await ojSelectSingle(driver, By.id('department-select'));
    const key = fetchKeyByFilter<JetSelectSingle<string,any>,string>(ss1, 'data', {
    op: '$eq',
    value: { DepartmentName: 'Finance' }
    });
    await ss1.changeValue(key);

Generated using TypeDoc