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

Breadcrumb

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

function Session::file

Upload a file: /session/:sessionId/se/file (POST) : /session/:sessionId/file (POST)

Parameters

array $arguments: An array with a single key/value. The key should be 'file' and the value should be a string containing base64 encoded contents of a file.

Return value

mixed

File

vendor/lullabot/php-webdriver/lib/WebDriver/Session.php, line 571

Class

Session
WebDriver\Session class

Namespace

WebDriver

Code

public function file(array $arguments) {
    // Since Selenium 4.17 the file URL has been prefixed with /se because
    // it is not a W3C command. See
    // https://github.com/w3c/webdriver/issues/1355 for discussions about
    // the W3C spec and file uploads.
    if ($this->isW3C()) {
        try {
            $result = $this->curl('POST', '/se/file', $arguments);
        } catch (Exception $e) {
        }
    }
    // Fallback to pre Selenium 4.17 behaviour and non W3C behaviour.
    if (!isset($result)) {
        $result = $this->curl('POST', '/file', $arguments);
    }
    return $result['value'];
}

API Navigation

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