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

Breadcrumb

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

function Selenium2Driver::rightClick

Overrides CoreDriver::rightClick

File

vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php, line 893

Class

Selenium2Driver
Selenium2 driver.

Namespace

Behat\Mink\Driver

Code

public function rightClick(string $xpath) {
    if ($this->isW3C()) {
        $actions = array(
            'actions' => [
                [
                    'type' => 'pointer',
                    'id' => 'mouse1',
                    'parameters' => [
                        'pointerType' => 'mouse',
                    ],
                    'actions' => [
                        [
                            'type' => 'pointerMove',
                            'duration' => 0,
                            'origin' => [
                                Element::WEB_ELEMENT_ID => $this->findElement($xpath)
                                    ->getID(),
                            ],
                            'x' => 0,
                            'y' => 0,
                        ],
                        [
                            'type' => 'pointerDown',
                            "button" => 2,
                        ],
                        [
                            'type' => 'pause',
                            'duration' => 500,
                        ],
                        [
                            'type' => 'pointerUp',
                            "button" => 2,
                        ],
                    ],
                ],
            ],
        );
        $this->getWebDriverSession()
            ->postActions($actions);
        $this->getWebDriverSession()
            ->deleteActions();
    }
    else {
        $this->mouseOver($xpath);
        $this->getWebDriverSession()
            ->click(array(
            'button' => 2,
        ));
    }
}

API Navigation

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