Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public function iFillInFieldWithoutLoosingFocus($field, $value) |
||
14 | { |
||
15 | $driver = $this->getSession()->getDriver(); |
||
16 | if ('Behat\Mink\Driver\Selenium2Driver' != get_class($driver)) { |
||
17 | $field = $this->fixStepArgument($field); |
||
18 | $value = $this->fixStepArgument($value); |
||
19 | |||
20 | $this->getSession()->getPage()->fillField($field, $value); |
||
21 | } else { |
||
22 | if (null === ($locator = $this->getSession()->getPage()->findField($field))) { |
||
23 | throw new \Exception(sprintf('Field "%s" not found.', $field)); |
||
24 | } |
||
25 | |||
26 | if (!($element = $driver->getWebDriverSession()->element('xpath', $locator->getXpath()))) { |
||
27 | throw new \Exception(sprintf('Field "%s" not found.', $field)); |
||
28 | } |
||
29 | |||
30 | $element->postValue(['value' => [$value]]); |
||
31 | } |
||
32 | } |
||
33 | |||
45 |