I am trying to run Robot Framework tests using the Browser library on macOS.
The tests fail with an error related to Node.js.
Environment:
OS: macOS (MacBook Air 13.3.1)
Python: running inside a virtual environment (.venv)
Robot Framework: installed via pip
Problem:
When running the test, the following error appears:
Couldn't execute node. Please ensure you have node.js installed and in PATH.
Original error is [Errno 2] No such file or directory: 'node'
Even though Node.js is installed and works in the terminal (node -v),
Robot Framework / Browser library still cannot find it when executing the tests.
What was already tried:
Installed Node.js via Homebrew
Verified node -v and npm -v work in terminal
Ran rfbrowser init
Activated the Python virtual environment before running tests
Question:
Is this a known issue on macOS (especially with virtual environments or VS Code)?
Are there recommended steps to make sure Robot Framework Browser can find Node.js correctly?
I sometimes get these errors, too, on fresh setups, for different reasons:
Sometimes VSCode has not been restarted is not aware that node had been added to PATH
I think once had a company setup that was so odd that node actually had been installed, but with a different name or something. I remember that I found the line of code inside Browser library that checks whether node is installed on startup. I disabled the check (comment it out) and it worked. But I donβt remember how I proceeded afterwards as that is not a long term solution.
On Linux, I had once installed VSCode / Codium from flatbpack, which meant VSCode ran in an isolated sandbox and could not access system applications like proper terminal. Maybe there is a similar thing for MacOS where you accidentally can choose VSCode from a software manager and install it in an isolated sandbox?
As alternative, browserlib can be used without external node installation if you dont need to install any external npm modules.
In addition to robotframework-browser, install also robotframework-browser-batteries pip module and instead of `rfbrowser init` you should just install the browsers you need ..