How to trigger keyboard shortcuts for Firefoxaddon with Selenium

Viewed 12

I am working on using Selenium to test our Firefox addon. I need to press ALT+SHIFT+T to switch to the analysis mode of our addon and then press ALT+SHIFT+A to trigger the analysis functionality. I am able to press ALT+SHIFT+T on 'about:config' (I have to adjust Firefox's configuration there). However, the keyboard shortcuts are not triggered on other websites using the same methodology.

await driver.get('about:config');
const switchAnalysis = Key.chord(Key.ALT, Key.SHIFT, 'T');
await driver.findElement(By.xpath('/html')).sendKeys(switchAnalysis);
await new Promise(resolve => setTimeout(resolve, 1000));

await driver.get('https://www.google.com/');
const startAnalysis = Key.chord(Key.SHIFT, Key.ALT, 'A');
await driver.findElement(By.xpath('/html')).sendKeys(startAnalysis);

I tried other methods like Actions API, but they all failed. Any advice?

0 Answers
Related