Accelerator mappings for Electron commands to Spectron/WebDriver key codes. Maps Electron Accelerators like "CommandOrControl+A"
to ["\uE03D", "a"]
(on OS X).
npm install spectron-keys
Takes a string accelerator
, like "CommandOrControl+A"
and an optional platform
string, and returns an array of WebDriver-ready unicode and keys to consume. platform
defaults to require("os").platform()
if not specified.
An object of constants mapping key names and modifiers to their unicode values used by WebDriver. Essentially, just exposes ./lib/webdriver-keys.json.
const spectronKeys = require("spectron-keys");
const { Application } = require("spectron");
const config = require("./config");
async function run () {
const app = new Application(config);
await app.start();
await app.client.keys(spectronKeys.mapAccelerator("CommandOrControl+A"));
}
npm test
MIT License, Copyright (c) 2016 Jordan Santell