How to use the webdriverio/build/utils.checkUnicode function in webdriverio

To help you get started, we’ve selected a few webdriverio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oxygenhq / oxygen / ox_modules / module-mob / commands / sendKeys.js View on Github external
// However ' DELETE /wd/hub/session/*/actions' is not implmeneted at the very least in uiatomator2
    // and `keys` crashes.
    // thus, do same thing as WDIO except releaseActions

    /**
     * replace key with corresponding unicode character
     */
    if (typeof value === 'string') {
        keySequence = checkUnicode(value);
    } else if (Array.isArray(value)) {
        // `instanceof Array` behaves strange when executed through vm.runInNewContext,
        // it returns false for arrays and `driver.keys()` tests for arrays using `instaceof Array`
        // thus we test using Array.isArray instead
        // https://github.com/felixge/node-sandboxed-module/issues/13#issuecomment-299585213
        for (const charSet of value) {
            keySequence = keySequence.concat(checkUnicode(charSet));
        }
    } else {
        throw new Error('"keys" command requires a string or array of strings as parameter');
    }

    /**
     * JsonWireProtocol action
     */
    if (!this.driver.isW3C) {
        this.driver.sendKeys(keySequence);
        return;
    }

    /**
     * W3C way of handle it key actions
     */
github oxygenhq / oxygen / ox_modules / module-mob / commands / sendKeys.js View on Github external
module.exports = function(value) {
    this.helpers.assertArgument(value);

    let keySequence = [];

    // WDIO implmentation of keys command invokes 'releaseActions' for W3C.
    // However ' DELETE /wd/hub/session/*/actions' is not implmeneted at the very least in uiatomator2
    // and `keys` crashes.
    // thus, do same thing as WDIO except releaseActions

    /**
     * replace key with corresponding unicode character
     */
    if (typeof value === 'string') {
        keySequence = checkUnicode(value);
    } else if (Array.isArray(value)) {
        // `instanceof Array` behaves strange when executed through vm.runInNewContext,
        // it returns false for arrays and `driver.keys()` tests for arrays using `instaceof Array`
        // thus we test using Array.isArray instead
        // https://github.com/felixge/node-sandboxed-module/issues/13#issuecomment-299585213
        for (const charSet of value) {
            keySequence = keySequence.concat(checkUnicode(charSet));
        }
    } else {
        throw new Error('"keys" command requires a string or array of strings as parameter');
    }

    /**
     * JsonWireProtocol action
     */
    if (!this.driver.isW3C) {

webdriverio

Next-gen browser and mobile automation test framework for Node.js

MIT
Latest version published 20 hours ago

Package Health Score

100 / 100
Full package analysis