I am always getting a "Failed: sendKeysToActiveElement" error while working on any of the keyboard actions of the actions class in protractor.
Below is my code -
it(' Tests to handle keyboard actions in Protractor ', async () => {
browser.manage().timeouts().implicitlyWait(15000);
browser.get("https://letcode.in/selectable")
browser.sleep(5000)
let elem_1 = element(by.xpath("(//h3[@id='clour'])[2]"))
let elem_2 = element(by.xpath("(//h3[@id='clour'])[4]"))
let elem_3 = element(by.xpath("(//h3[@id='clour'])[5]"))
let elem_4 = element(by.xpath("(//h3[@id='clour'])[9]"))
await browser.actions()
.click(await elem_1.getWebElement())
.keyDown(protractor.Key.CONTROL)
.click(await elem_2.getWebElement())
.keyUp(protractor.Key.CONTROL)
.perform();
});
My conf.js -
require("babel-register")({
presets: ["es2015"]
});
exports.config = {
framework: 'jasmine',
SELENIUM_PROMISE_MANAGER: true,
specs: ['selectMultiElement.js'],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['show-fps-counter=true', '--window-size=1920x1280']
}
}
};
I am getting the error as - UnsupportedOperationError: sendKeysToActiveElement Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'LAPTOP-HGJU6DES', ip: '192.168.1.6', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '18.0.1.1' Driver info: driver.version: unknown
Can anyone suggest what can be the solution of this error please.
I am using chrome 102 version.
I tried adding 'w3c': false in chromeOptions but that also showed some different error. Running the code with this argument it is opening 3 instances of the chromedriver but not being able to proceed with any command in the script thus eventually failing the script.
Changing the framework from jasmine to jasmine2 worked for me.