Install Robot and Browser lib with a Bash script in Ubuntu

Hi. I have created a simple bash script to automatically setup Robot and Browser on a new Ubuntu 22.04 (WSL).
There is a problem with this script that I can’t figure out.
There is no error in the rfbrowser init phase - everything looks good in the logs
But, when I run a Test, Playwright gives an error - missing dependencies
Asking me to install them using this command - and then it works fine.
sudo npx playwright install-deps -y

rfbrowser init should have installed all of that … but maybe in a different location !!
Are the pip3 install commands in this script are run as sudo ?
If that is the bug, How to switch to “user” before running the pip3 install and rfbrowser init section?


#!/bin/bash

Update Ubuntu and Install dependencies

Sourcing versions: Python = 3.10 and NodeJS = 20.11

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash
sudo apt update -y
sudo apt upgrade -y
sudo apt install python3.10 -y
sudo apt install python3-pip -y
sudo apt install python3-tk -y
sudo apt install nodejs -y

Install VS Code extensions

code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension ms-python.pylint
code --install-extension robocorp.robotframework-lsp
code --install-extension ms-vscode.live-server

Install Robot, Libraries and RFBrowser binaries

pip3 install --upgrade --requirement requirements.txt
rfbrowser clean-node
rfbrowser init


requirements.txt has only those two lines :
robotframework
robotframework-browser

Thanks

rfbrowser init would download and install nodejs dependencies, but system dependencies you should install yourself. If you are on Ubuntu running sudo npx playwright install-deps -y should be enough.

1 Like

Yes thanks, I have added that to the script - after the rfbrowser init
but the -y seems to not work at the end. This works :
sudo npx -y playwright install-deps