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

Breadcrumb

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

function BrowserKitDriver::click

Overrides CoreDriver::click

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 484

Class

BrowserKitDriver
Symfony BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function click(string $xpath) {
    $crawler = $this->getFilteredCrawler($xpath);
    $node = $this->getCrawlerNode($crawler);
    $tagName = $node->nodeName;
    if ('a' === $tagName) {
        $this->client
            ->click($crawler->link());
        $this->forms = array();
    }
    elseif ($this->canSubmitForm($node)) {
        $this->submit($crawler->form());
    }
    elseif ($this->canResetForm($node)) {
        $this->resetForm($node);
    }
    else {
        $message = sprintf('%%s supports clicking on links and submit or reset buttons only. But "%s" provided', $tagName);
        throw new UnsupportedDriverActionException($message, $this);
    }
}

API Navigation

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