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

Breadcrumb

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

function BrowserKitDriver::attachFile

Overrides CoreDriver::attachFile

File

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

Class

BrowserKitDriver
Symfony BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function attachFile(string $xpath, string $path) {
    $field = $this->getFormField($xpath);
    if (!$field instanceof FileFormField) {
        throw new DriverException(sprintf('Impossible to attach a file on the element with XPath "%s" as it is not a file input', $xpath));
    }
    $field->upload($path);
}

API Navigation

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