SahiDriver provides a bridge for the Sahi browser controller. Sahi is a new JS browser controller, that fast replaced the old Selenium testing suite. It’s both easier to setup and to use than classical Selenium. It has a GUI installer for each popular operating system out there and is able to control every systems browser through a special bundled proxy server.
SahiDriver is available through Composer:
$ composer require behat/mink-sahi-driver
In order to talk with a real browser through Sahi, you should install and configure Sahi first:
Download and run the Sahi jar from the Sahi project website and run it. It will run the installer, which will guide you through the installation process.
Run Sahi proxy before your test suites (you can start this proxy during system startup):
cd $YOUR_PATH_TO_SAHI/bin ./sahi.sh
After installing Sahi and running the Sahi proxy server, you will be able
to control it with
$driver = new \Behat\Mink\Driver\SahiDriver('firefox');
Notice, that the first argument of
SahiDriver is always a browser name,
supported by Sahi.
If you want more control during the driver initialization, like for example if you want to configure the driver to talk with a proxy on another machine, use the more verbose version with a second client argument:
$driver = new \Behat\Mink\Driver\SahiDriver( 'firefox', new \Behat\SahiClient\Client( new \Behat\SahiClient\Connection($sid, $host, $port) ) );
$sid is a Sahi session ID. It’s a unique string, used by the driver
and the Sahi proxy in order to be able to talk with each other. You should
fill this with
null if you want Sahi to start your browser automatically
or with some unique string if you want to control an already started
$host simply defines the host on which Sahi is started. It is
$port defines a Sahi proxy port. The default one is