This is a node api add-on that wraps the Microsoft UI Automation Library. The majority of COM functionality is wrapped using napi. There may be a few missing things like proxies, however the majority of the functionality is here.
npm install @bright-fish/node-ui-automationnpm install @bright-fish/node-ui-automation
javascript
const { Automation, PropertyIds, TreeScopes, PatternIds } = require('@bright-fish/node-ui-automation');
const automation = new Automation();
const desktopElement = automation.getRootElement();
const aboutWindowsProperty = automation.createPropertyCondition(PropertyIds.NamePropertyId, 'About Windows');
const winverWindow = desktopElement.findFirst(TreeScopes.Subtree, aboutWindowsProperty);
const okProperty = automation.createPropertyCondition(PropertyIds.NamePropertyId, "OK");
const okButton = winverWindow.findFirst(TreeScopes.Subtree, okProperty);
const invokeProvider = okButton.getCurrentPattern(PatternIds.InvokePatternId);
invokeProvider.invoke();
``