Gathering detailed insights and metrics for @nut-tree-fork/nut-js
Gathering detailed insights and metrics for @nut-tree-fork/nut-js
Gathering detailed insights and metrics for @nut-tree-fork/nut-js
Gathering detailed insights and metrics for @nut-tree-fork/nut-js
npm install @nut-tree-fork/nut-js
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,291 Stars
973 Commits
130 Forks
22 Watching
2 Branches
10 Contributors
Updated on 28 Nov 2024
TypeScript (97.05%)
JavaScript (2.65%)
HTML (0.16%)
CSS (0.08%)
Shell (0.06%)
Cumulative downloads
Total Downloads
Last day
-11%
97
Compared to previous day
Last week
26.5%
663
Compared to previous week
Last month
-48.9%
3,501
Compared to previous month
Last year
0%
17,598
Compared to previous year
GitHub Actions | |
---|---|
Master | |
Develop |
Please visit
for detailed documentation and tutorials
Most importantly,
nut.js
is a cross-platform native UI automation / testing tool.
It allows for native UI interactions via keyboard and / or mouse, but additionally gives you the possibility to navigate the screen based on image matching.
If you came here after I removed public packages from npm as announced in 'the blog post', please be aware that
nut.js
is developed with community in mind.
A huge "Thank you!" goes out to all sponsors who make open source a bit more sustainable!
Check out this demo video to get a first impression of what nut.js is capable of.
Please consult the project website at nutjs.dev for in-depth tutorials
nut.js provides public API documentation auto-generated by TypeDoc.
Feel free to join our Discord community
This list gives an overview on currently implemented and planned functionality. It's work in progress and will undergo constant modification.
(*) Requires an additional provider package, visit nutjs.dev for more info
The following snippet shows a valid nut.js
example (using multiple addons):
1"use strict"; 2 3const { 4 mouse, 5 screen, 6 singleWord, 7 sleep, 8 useConsoleLogger, 9 ConsoleLogLevel, 10 straightTo, 11 centerOf, 12 Button, 13 getActiveWindow, 14} = require("@nut-tree/nut-js"); 15const { 16 preloadLanguages, 17 Language, 18 LanguageModelType, 19 configure, 20} = require("@nut-tree/plugin-ocr"); 21 22configure({ languageModelType: LanguageModelType.BEST }); 23 24useConsoleLogger({ logLevel: ConsoleLogLevel.DEBUG }); 25 26screen.config.autoHighlight = true; 27screen.config.ocrConfidence = 0.8; 28 29function activeWindowRegion() { 30 return getActiveWindow().then((activeWindow) => activeWindow.region); 31} 32 33(async () => { 34 await preloadLanguages([Language.English], [LanguageModelType.BEST]); 35 await sleep(5000); 36 const result = await screen.find(singleWord("@nut-tree/nut-js")); 37 await mouse.move(straightTo(centerOf(result))); 38 await mouse.click(Button.LEFT); 39 await screen.waitFor(singleWord("Native"), 15000, 1000, { 40 providerData: { partialMatch: true }, 41 }); 42 const content = await screen.read({ searchRegion: activeWindowRegion() }); 43 console.log(content); 44})();
This section lists runtime requirements for nut.js
on the respective target platform.
In case you're running Windows 10 N and want to use ImageFinder plugins, please make sure to have the Media Feature Pack installed.
On macOS, Xcode command line tools are required. You can install them by running
1xcode-select --install
Permissions:
nut.js requires the executing application, e.g. your terminal, to be given both Accessibility
and Screen Recording
permissions.
Starting with release 2.3.0
, nut.js will check for and request these permissions automatically:
It will also give you a subtle hint in case permissions are lacking:
Accessibility: ##### WARNING! The application running this script is not a trusted process! Please visit https://github.com/nut-tree/nut.js#macos #####
##### WARNING! The application running this script is not allowed to capture screen content! Please visit https://github.com/nut-tree/nut.js#macos #####
Attention:
Prior to release 2.3.0
you'll have to grant these permissions manually.
Settings -> Security & Privacy -> Privacy tab -> Accessibility -> Add...
For example, if you want to execute your node script in e.g. iTerm2
, you'd have to add iTerm.app
to the list.
When running your script from a built-in terminal in e.g. VSCode
or IntelliJ
, you'd have to add the respective IDE.
Depending on your distribution, Linux setups may differ.
In general, nut.js
requires
Installation on *buntu
distributions:
1sudo apt-get install libxtst-dev
Setups on other distributions might differ.
Attention:
At the moment nut.js only supports X11.
Wayland is NOT supported!
On e.g. Ubuntu you can switch to XWayland on your login screen as a workaround.
nut.js
The core functionality of nut.js
is open source and available on GitHub.
To build nut.js from source you'll have to build native dependencies first.
nut.js
to point to your local build of libnut-core
Pre-built packages are available for subscription plans.
Check out the pricing page for more information.
Once you subscribed to a plan, you'll receive a token which you can use to install the respective package, check out the registry access tutorial for reference.
With everything set up, running
1npm i @nut-tree/nut-js
or
1yarn add @nut-tree/nut-js
will install nut.js
and its required dependencies.
nut.js
also provides snapshot releases which allows to test upcoming features.
Running
1npm i @nut-tree/nut-js@next
or
1yarn add @nut-tree/nut-js@next
will install the most recent development release of nut.js
.
Attention: While snapshot releases are great to work with upcoming features before a new stable release, it is still a snapshot release. Please bear in mind that things might change and / or break on snapshot releases, so it is not recommended using them in production.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
SAST tool is run on all commits
Details
Reason
0 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 4
Reason
6 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More