If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Behat Driver Update

From MoodleDocs

Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.

This documentation relates to MDL-66979 and changes to the WebDriver implementation that we use within Moodle's Behat testing infrastructure. It describes common scenarios which you may encounter as a result of these changes, and how to address them.

These changes affect the following branches, from Friday 29th January 2021 onwards:

  • master (Moodle 4.0 development)
  • MOODLE_311_STABLE (Moodle 3.11 development)
  • MOODLE_310_STABLE (Moodle 3.10 release branch)
  • MOODLE_39_STABLE (Moodle 3.9 release branch)

Note: Changes to Behat, and Behat infrastructure are typically applied to all supported branches and are not master-only. Ordinarily this includes security release, but minimum PHP version support prevents that on this occasion.

Checking the type of Mink Driver

There are a small number of occasions where you may felt that you needed to check the type of driver currently in use. To do so, you may have used code such as the following:

$driver = $this->session->getDriver();
if ($driver instanceof \Moodle\BehatExtension\Driver\MoodleSelenium2Driver) {
    // ...

As part of this change, we have changed the driver that we use from Mink\MinkSelenium2Driver to OAndreyev\MinkPhpWebDriver. The way in which Moodle extends the driver has also changed, and it is now located at



Please note that the underliyng API for the driver may have also changed.

$driver = $this->session->getDriver();
if ($driver instanceof \Moodle\BehatExtension\Driver\WebDriver) {
    // ...

Accessing the WebDriver directly

The general recommendation is that you should not need to access the WebDriver implementation directly. In the unusual situation that you do need to access WebDriver, then you may have used code such as the following:


The Mink Driver implementation now in use (returned by


) has a different API to the original


and no longer has a



In addition the WebDriver implementation has a different API, more in-keeping with the Java WebDriver API. You may need to update your calls within the WebDriver implementation.

The replacement for the above example is:

    'value' => $keys,