The following steps are required to set up Sakuli to work with multiple browsers. Once the initial setup is done, we will dive right into our first test.
Sakuli utilizes the WebDriver protocol to remote control browsers during test execution.
In addition to the browser itself, you need to install the corresponding WebDriver as well.
Several wrapper packages can be found on npmjs.com, which allow the installation of the required binaries via npm
.
Since some users encountered issues with geckodriver on Firefox, we recommend using chromedriver for now. We are working on fixes and workarounds for geckodriver.
Therefore, Chrome is the preferred browser for running Sakuli tests at the moment. A suitable WebDriver can be installed via:
npm i chromedriver
or
yarn add chromedriver
There are also WebDriver packages for IE and Edge. macOS already ships a WebDriver for Safari, so there is no need to install an additional package.
Attention: Be careful to install the correct version of a WebDriver package according to the installed browser version. To install e.g. ChromeDriver for Chrome 73 you have to install:
npm i chromedriver@73.0.0
Sakuli is not limited to work with only a single browser. When installing multiple WebDriver packages, you can easily switch between different browsers.
You will have to manually add the respective WebDriver location to your systems PATH
variable, otherwise Sakuli will not be able to find and use it. Therefore, we recommend a global driver installation on Windows.
npm i -g chromedriver
yarn global add chromedriver
Once you installed a WebDriver package via npm, you will be prompted with its installation path, so you can easily add it to your %PATH%
variable.
Sample path:
%USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\chromedriver\\lib\\chromedriver\\
One of Sakuli’s core components, nut.js, requires OpenCV. Sakuli ships a pre-built version of OpenCV. Nonetheless, the installation still requires some 3rd-party dependencies.
Note: We recommend using PowerShell during the installation. When using the standard terminal CMD, the installation process might lead to failures due to different behaviour.
In order to install and run Sakuli on Windows you need two additional tools: Python 2 and the Windows Build Tools.
To avoid eventual installation problems for Windows users we recommend to first install Python 2 on your system separately by downloading the required version from the official web page. Afterwards you can install the Windows Build Tools manually or via NPM using:
npm install --global windows-build-tools
or
yarn global add windows-build-tools
In case of errors while installing the Windows Build Tools package via npm
, please make sure that the PowerShell is available on your system PATH
. Additionally, you should install the Windows Build Tools by using the PowerShell in administrative mode.
See this issue.
On macOS, Xcode command line tools are required. You can install them by running:
xcode-select --install
Depending on your distribution, Linux setups may differ.
In general, Sakuli requires:
Installation on *buntu:
sudo apt-get install build-essential python libxtst-dev libpng++-dev
The installation process is an open issue and will be improved in the near future, so using Sakuli will become even more enjoyable!
We will now install Sakuli in our newly created project by running:
npm i @sakuli/cli
or
yarn add @sakuli/cli
This will install Sakuli and its required dependencies.