javascriptui-automationwdio

Webdriverio 8 unable to perform CTRL + Multiple clicks


I Have a couple of columns i need to press ctrl button then select multiple columns. I tried many ways but ctrl is not performed.

await browser.keys(Key.Control);
    await campaignNameColumn.click();
    await browser.keys(Key.Control);
    await monthColumn.click();

Also tried perfromaactions, No luck yet. I am using WDIO - 8 and node 16


Solution

  • Finally this worked for me.

        await browser.performActions([
            {
              type: "key",
              id: "keyboard",
              actions: [{ type: "keyDown", value: "" }],
            },
          ]);
        await campaignNameColumn.click();
        await monthColumn.click();
        await browser.performActions([
          {
            type: "key",
            id: "keyboard",
            actions: [{ type: "keyUp", value: "" }],
          },
        ]);
      });