I want to fill data input field whose is the child of the div whose class is form
in behat
<div class="form">
<form method="post" action="abc" class="redeem-form">
<span></span>
<input type="text" value="Voucher Code" id="voucher-code" name="vocuher_code">
</form>
</div>
Feature file is :
And I filled in "voucher-code" with "7f2904204489727e" element
feature context file :
/**
* @When /^(?:|I )filled in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)" element$/
*/
public function fillField($field, $values)
{
$field = $this->fixStepArgument($field);
$value = $this->fixStepArgument($value);
$element = $this->getSession()->getPage()->find('xpath','//div[@class="form"]//input[@id="'.$field.'"]');
$this->getSession()->getPage()->fillField($element, $value);
}