<commit_before>const utils = require('./utils');

function sendCommand(sendSessionCommand, elementId, method, uri, body) {
    return sendSessionCommand(method, `element/${elementId}${utils.formatUri(uri)}`, body);
}

function sendKeys(sendElementCommand, text) {
    return sendElementCommand('POST', 'value', {
        value: [text]
    });
}

function click(sendElementCommand) {
    return sendElementCommand('POST', 'click');
}

function getText(sendElementCommand) {
    return sendElementCommand('GET', 'text');
}

function findElement(sendSessionCommand, strategy, selector) {
    return sendSessionCommand('POST', 'element', {
        using: strategy,
        value: selector
    }).then((body) => {
        const sendElementCommand = sendCommand.bind(null, sendSessionCommand, body.ELEMENT);
        return {
            sendKeys: sendKeys.bind(null, sendElementCommand),
            click: click.bind(null, sendElementCommand),
            getText: getText.bind(null, sendElementCommand)
        };
    });
}

module.exports = {
    findElement
};
<commit_msg>Adding getCss for elements<commit_after>const utils = require('./utils');

function sendCommand(sendSessionCommand, elementId, method, uri, body) {
    return sendSessionCommand(method, `element/${elementId}${utils.formatUri(uri)}`, body);
}

function sendKeys(sendElementCommand, text) {
    return sendElementCommand('POST', 'value', {
        value: [text]
    });
}

function click(sendElementCommand) {
    return sendElementCommand('POST', 'click');
}

function getText(sendElementCommand) {
    return sendElementCommand('GET', 'text');
}

function getCss(sendElementCommand, propertyName) {
    return sendElementCommand('GET', `css/${propertyName}`);
}

function findElement(sendSessionCommand, strategy, selector) {
    return sendSessionCommand('POST', 'element', {
        using: strategy,
        value: selector
    }).then((body) => {
        const sendElementCommand = sendCommand.bind(null, sendSessionCommand, body.ELEMENT);
        return {
            sendKeys: sendKeys.bind(null, sendElementCommand),
            click: click.bind(null, sendElementCommand),
            getText: getText.bind(null, sendElementCommand),
            getCss: getCss.bind(null, sendElementCommand)
        };
    });
}

module.exports = {
    findElement
};

{'fraction_non_alphanumeric': 0.13090128755364808, 'fraction_numerical': 0.0, 'mean_word_length': 3.9177215189873418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7099296', 'n_tokens_mistral': 644, 'n_tokens_neox': 646, 'n_words': 132}