Q:

Unable to loop through selection of multiple elements from a grid

I'm trying to select multiple rows from a grid by control clicking on each row but only the first one seems to be clicked.
This is what I'm trying:
this.selectScan = async function (rows) {
    for (let i=0; i < rows.length; i++) {
        let scanRow = scansList.element(by.css("div[row=\"" + rows[i] + "\"]")).element(by.css("div[colid=\"originalFilename\"]"));
        await browser.actions()
            .mouseMove(scanRow)
            .keyDown(protractor.Key.CONTROL)
            .click()
            .keyUp(protractor.Key.CONTROL)
            .perform();
    }
};

I'm calling this by passing an array of row ids as:
selectScan(["2", "3"]);

I've also tried to chain all the key and mouse clicks and then execute perform() as suggested here but it didn't help.

A:

I got it working by simulating CTLR keyDown, then clicking on element and then releasing the CTRL key:
 this.selectScan = async function (rows) {
    for (let i = 0; i < rows.length; i++) {
        let scanRow = scansList.element(by.css("div[row=\"" + rows[i] + "\"]")).element(by.css("div[colid=\"originalFilename\"]"));
        await browser.actions()
            .keyDown(protractor.Key.CONTROL)
            .perform();
        await scanRow.click();
        await browser.actions()
            .keyUp(protractor.Key.CONTROL)
            .perform();
    }
};

