protected function FeatureContext::fillFieldByJS in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Fills a field using JS to avoid event firing.
Parameters
string $field:
string$value:
2 calls to FeatureContext::fillFieldByJS()
- FeatureContext::iSelectTheRoomForPackage in test/
features/ bootstrap/ FeatureContext.php - @Given /^I select the "(?P<unit_name>[^"]*)" room for package$/
- FeatureContext::referenceUnitsInTheField in test/
features/ bootstrap/ FeatureContext.php - @Given /^reference units "(?<unit_names>[^"]*)" in the "(?<field_name>[^"]*)" field$/
File
- test/
features/ bootstrap/ FeatureContext.php, line 1095
Class
- FeatureContext
- Features context.
Code
protected function fillFieldByJS($field, $value) {
$field = str_replace('\\"', '"', $field);
$value = str_replace('\\"', '"', $value);
$xpath = $this
->getSession()
->getPage()
->findField($field)
->getXpath();
$element = $this
->getSession()
->getDriver()
->getWebDriverSession()
->element('xpath', $xpath);
$elementID = $element
->getID();
$subscript = "arguments[0]";
$script = str_replace('{{ELEMENT}}', $subscript, '{{ELEMENT}}.value = "' . $value . '"');
return $this
->getSession()
->getDriver()
->getWebDriverSession()
->execute(array(
'script' => $script,
'args' => array(
array(
'ELEMENT' => $elementID,
),
),
));
}