Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CoreDriver.php

class CoreDriver

Core driver. All other drivers should extend this class for future compatibility.

@author Konstantin Kudryashov <ever.zet@gmail.com>

Hierarchy

  • class \Behat\Mink\Driver\CoreDriver implements \Behat\Mink\Driver\DriverInterface

Expanded class hierarchy of CoreDriver

File

vendor/behat/mink/src/Driver/CoreDriver.php, line 25

Namespace

Behat\Mink\Driver
View source
abstract class CoreDriver implements DriverInterface {
    
    /**
     * @var Session
     */
    private $session;
    
    /**
     * @return void
     *
     * @final since 1.11
     */
    public function setSession(Session $session) {
        $this->session = $session;
    }
    
    /**
     * @return void
     *
     * @throws DriverException When the driver cannot be started
     */
    public function start() {
        throw new UnsupportedDriverActionException('Starting the driver is not supported by %s', $this);
    }
    
    /**
     * @return bool
     */
    public function isStarted() {
        throw new UnsupportedDriverActionException('Checking the driver state is not supported by %s', $this);
    }
    
    /**
     * @return void
     *
     * @throws DriverException When the driver cannot be closed
     */
    public function stop() {
        throw new UnsupportedDriverActionException('Stopping the driver is not supported by %s', $this);
    }
    
    /**
     * @return void
     */
    public function reset() {
        throw new UnsupportedDriverActionException('Resetting the driver is not supported by %s', $this);
    }
    
    /**
     * @param string $url
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function visit(string $url) {
        throw new UnsupportedDriverActionException('Visiting an url is not supported by %s', $this);
    }
    
    /**
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getCurrentUrl() {
        throw new UnsupportedDriverActionException('Getting the current url is not supported by %s', $this);
    }
    
    /**
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function reload() {
        throw new UnsupportedDriverActionException('Page reloading is not supported by %s', $this);
    }
    
    /**
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function forward() {
        throw new UnsupportedDriverActionException('Forward action is not supported by %s', $this);
    }
    
    /**
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function back() {
        throw new UnsupportedDriverActionException('Backward action is not supported by %s', $this);
    }
    
    /**
     * @param string|false $user
     * @param string       $password
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function setBasicAuth($user, string $password) {
        throw new UnsupportedDriverActionException('Basic auth setup is not supported by %s', $this);
    }
    
    /**
     * @param string|null $name
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function switchToWindow(?string $name = null) {
        throw new UnsupportedDriverActionException('Windows management is not supported by %s', $this);
    }
    
    /**
     * @param string|null $name
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function switchToIFrame(?string $name = null) {
        throw new UnsupportedDriverActionException('iFrames management is not supported by %s', $this);
    }
    
    /**
     * @param string $name
     * @param string $value
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function setRequestHeader(string $name, string $value) {
        throw new UnsupportedDriverActionException('Request headers manipulation is not supported by %s', $this);
    }
    
    /**
     * @return array<string, string|string[]>
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getResponseHeaders() {
        throw new UnsupportedDriverActionException('Response headers are not available from %s', $this);
    }
    
    /**
     * @param string      $name
     * @param string|null $value
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function setCookie(string $name, ?string $value = null) {
        throw new UnsupportedDriverActionException('Cookies manipulation is not supported by %s', $this);
    }
    
    /**
     * @param string $name
     *
     * @return string|null
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getCookie(string $name) {
        throw new UnsupportedDriverActionException('Cookies are not available from %s', $this);
    }
    
    /**
     * @return int
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getStatusCode() {
        throw new UnsupportedDriverActionException('Status code is not available from %s', $this);
    }
    
    /**
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getContent() {
        throw new UnsupportedDriverActionException('Getting the page content is not supported by %s', $this);
    }
    
    /**
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getScreenshot() {
        throw new UnsupportedDriverActionException('Screenshots are not supported by %s', $this);
    }
    
    /**
     * @return string[]
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getWindowNames() {
        throw new UnsupportedDriverActionException('Listing all window names is not supported by %s', $this);
    }
    
    /**
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getWindowName() {
        throw new UnsupportedDriverActionException('Listing this window name is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return NodeElement[]
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     *
     * @final since 1.11
     */
    public function find(string $xpath) {
        $elements = array();
        foreach ($this->findElementXpaths($xpath) as $xpath) {
            $elements[] = new NodeElement($xpath, $this->session);
        }
        return $elements;
    }
    
    /**
     * Finds elements with specified XPath query.
     *
     * @see find()
     *
     * @param string $xpath
     *
     * @return string[] The XPath of the matched elements
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    protected function findElementXpaths(string $xpath) {
        throw new UnsupportedDriverActionException('Finding elements is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getTagName(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the tag name is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getText(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the element text is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getHtml(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the element inner HTML is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return string
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getOuterHtml(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the element outer HTML is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     * @param string $name
     *
     * @return string|null
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getAttribute(string $xpath, string $name) {
        throw new UnsupportedDriverActionException('Getting the element attribute is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return string|bool|array|null
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function getValue(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the field value is not supported by %s', $this);
    }
    
    /**
     * @param string            $xpath
     * @param string|bool|array $value
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function setValue(string $xpath, $value) {
        throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function check(string $xpath) {
        throw new UnsupportedDriverActionException('Checking a checkbox is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function uncheck(string $xpath) {
        throw new UnsupportedDriverActionException('Unchecking a checkbox is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return bool
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function isChecked(string $xpath) {
        throw new UnsupportedDriverActionException('Getting the state of a checkbox is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     * @param string $value
     * @param bool   $multiple
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function selectOption(string $xpath, string $value, bool $multiple = false) {
        throw new UnsupportedDriverActionException('Selecting an option is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return bool
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function isSelected(string $xpath) {
        throw new UnsupportedDriverActionException('Element selection check is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function click(string $xpath) {
        throw new UnsupportedDriverActionException('Clicking on an element is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function doubleClick(string $xpath) {
        throw new UnsupportedDriverActionException('Double-clicking is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function rightClick(string $xpath) {
        throw new UnsupportedDriverActionException('Right-clicking is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     * @param string $path
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function attachFile(string $xpath, string $path) {
        throw new UnsupportedDriverActionException('Attaching a file in an input is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return bool
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function isVisible(string $xpath) {
        throw new UnsupportedDriverActionException('Element visibility check is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function mouseOver(string $xpath) {
        throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function focus(string $xpath) {
        throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function blur(string $xpath) {
        throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string              $xpath
     * @param string|int          $char
     * @param KeyModifier::*|null $modifier
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function keyPress(string $xpath, $char, ?string $modifier = null) {
        throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string              $xpath
     * @param string|int          $char
     * @param KeyModifier::*|null $modifier
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function keyDown(string $xpath, $char, ?string $modifier = null) {
        throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string              $xpath
     * @param string|int          $char
     * @param KeyModifier::*|null $modifier
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function keyUp(string $xpath, $char, ?string $modifier = null) {
        throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string $sourceXpath
     * @param string $destinationXpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function dragTo(string $sourceXpath, string $destinationXpath) {
        throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
    }
    
    /**
     * @param string $script
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function executeScript(string $script) {
        throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
    }
    
    /**
     * @param string $script
     *
     * @return mixed
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function evaluateScript(string $script) {
        throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
    }
    
    /**
     * @param int    $timeout
     * @param string $condition
     *
     * @return bool
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function wait(int $timeout, string $condition) {
        throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
    }
    
    /**
     * @param int         $width
     * @param int         $height
     * @param string|null $name
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function resizeWindow(int $width, int $height, ?string $name = null) {
        throw new UnsupportedDriverActionException('Window resizing is not supported by %s', $this);
    }
    
    /**
     * @param string|null $name
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function maximizeWindow(?string $name = null) {
        throw new UnsupportedDriverActionException('Window maximize is not supported by %s', $this);
    }
    
    /**
     * @param string $xpath
     *
     * @return void
     *
     * @throws UnsupportedDriverActionException When operation not supported by the driver
     * @throws DriverException                  When the operation cannot be done
     */
    public function submitForm(string $xpath) {
        throw new UnsupportedDriverActionException('Form submission is not supported by %s', $this);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CoreDriver::$session private property
CoreDriver::attachFile public function Overrides DriverInterface::attachFile 2
CoreDriver::back public function Overrides DriverInterface::back 2
CoreDriver::blur public function Overrides DriverInterface::blur 1
CoreDriver::check public function Overrides DriverInterface::check 2
CoreDriver::click public function Overrides DriverInterface::click 2
CoreDriver::doubleClick public function Overrides DriverInterface::doubleClick 1
CoreDriver::dragTo public function Overrides DriverInterface::dragTo 1
CoreDriver::evaluateScript public function Overrides DriverInterface::evaluateScript 1
CoreDriver::executeScript public function Overrides DriverInterface::executeScript 1
CoreDriver::find public function @final since 1.11 Overrides DriverInterface::find
CoreDriver::findElementXpaths protected function Finds elements with specified XPath query. 2
CoreDriver::focus public function Overrides DriverInterface::focus 1
CoreDriver::forward public function Overrides DriverInterface::forward 2
CoreDriver::getAttribute public function Overrides DriverInterface::getAttribute 2
CoreDriver::getContent public function Overrides DriverInterface::getContent 2
CoreDriver::getCookie public function Overrides DriverInterface::getCookie 2
CoreDriver::getCurrentUrl public function Overrides DriverInterface::getCurrentUrl 2
CoreDriver::getHtml public function Overrides DriverInterface::getHtml 2
CoreDriver::getOuterHtml public function Overrides DriverInterface::getOuterHtml 2
CoreDriver::getResponseHeaders public function Overrides DriverInterface::getResponseHeaders 1
CoreDriver::getScreenshot public function Overrides DriverInterface::getScreenshot 1
CoreDriver::getStatusCode public function Overrides DriverInterface::getStatusCode 1
CoreDriver::getTagName public function Overrides DriverInterface::getTagName 2
CoreDriver::getText public function Overrides DriverInterface::getText 2
CoreDriver::getValue public function Overrides DriverInterface::getValue 2
CoreDriver::getWindowName public function Overrides DriverInterface::getWindowName 1
CoreDriver::getWindowNames public function Overrides DriverInterface::getWindowNames 1
CoreDriver::isChecked public function Overrides DriverInterface::isChecked 2
CoreDriver::isSelected public function Overrides DriverInterface::isSelected 2
CoreDriver::isStarted public function Overrides DriverInterface::isStarted 2
CoreDriver::isVisible public function Overrides DriverInterface::isVisible 1
CoreDriver::keyDown public function Overrides DriverInterface::keyDown 1
CoreDriver::keyPress public function Overrides DriverInterface::keyPress 1
CoreDriver::keyUp public function Overrides DriverInterface::keyUp 1
CoreDriver::maximizeWindow public function Overrides DriverInterface::maximizeWindow 1
CoreDriver::mouseOver public function Overrides DriverInterface::mouseOver 1
CoreDriver::reload public function Overrides DriverInterface::reload 2
CoreDriver::reset public function Overrides DriverInterface::reset 2
CoreDriver::resizeWindow public function Overrides DriverInterface::resizeWindow 1
CoreDriver::rightClick public function Overrides DriverInterface::rightClick 1
CoreDriver::selectOption public function Overrides DriverInterface::selectOption 2
CoreDriver::setBasicAuth public function Overrides DriverInterface::setBasicAuth 1
CoreDriver::setCookie public function Overrides DriverInterface::setCookie 2
CoreDriver::setRequestHeader public function Overrides DriverInterface::setRequestHeader 1
CoreDriver::setSession public function @final since 1.11 Overrides DriverInterface::setSession
CoreDriver::setValue public function Overrides DriverInterface::setValue 2
CoreDriver::start public function Overrides DriverInterface::start 2
CoreDriver::stop public function Overrides DriverInterface::stop 2
CoreDriver::submitForm public function Overrides DriverInterface::submitForm 2
CoreDriver::switchToIFrame public function Overrides DriverInterface::switchToIFrame 1
CoreDriver::switchToWindow public function Overrides DriverInterface::switchToWindow 1
CoreDriver::uncheck public function Overrides DriverInterface::uncheck 2
CoreDriver::visit public function Overrides DriverInterface::visit 2
CoreDriver::wait public function Overrides DriverInterface::wait 1

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal