c7cd2ebbcad171f11d64256d46e0f3023dc676b6
[yaffs-website] / vendor / jcalderonzumba / mink-phantomjs-driver / src / MouseTrait.php
1 <?php
2
3 namespace Zumba\Mink\Driver;
4
5 use Behat\Mink\Exception\DriverException;
6
7 /**
8  * Class MouseTrait
9  * @package Zumba\Mink\Driver
10  */
11 trait MouseTrait {
12
13   /**
14    * Generates a mouseover event on the given element by xpath
15    * @param string $xpath
16    * @throws DriverException
17    */
18   public function mouseOver($xpath) {
19     $element = $this->findElement($xpath, 1);
20     $this->browser->hover($element["page_id"], $element["ids"][0]);
21   }
22
23   /**
24    * Clicks if possible on an element given by xpath
25    * @param string $xpath
26    * @return mixed
27    * @throws DriverException
28    */
29   public function click($xpath) {
30     $elements = $this->findElement($xpath, 1);
31     $this->browser->click($elements["page_id"], $elements["ids"][0]);
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   /**
38    * Double click on element found via xpath
39    * @param string $xpath
40    * @throws DriverException
41    */
42   public function doubleClick($xpath) {
43     $elements = $this->findElement($xpath, 1);
44     $this->browser->doubleClick($elements["page_id"], $elements["ids"][0]);
45   }
46
47   /**
48    * Right click on element found via xpath
49    * @param string $xpath
50    * @throws DriverException
51    */
52   public function rightClick($xpath) {
53     $elements = $this->findElement($xpath, 1);
54     $this->browser->rightClick($elements["page_id"], $elements["ids"][0]);
55   }
56
57 }