0

I am not able to click on submit button. I have html as shown below.

`<input id="edit-submit" class="form-submit" type="submit" value="Achteraf betalen" name="submit" onclick="return validate_step3();">` <br>

I am using the iPress function as shown below in features.php file. I tried with iClick(), iClickElementWithId() But not able click at all.

/**
 * @Given /^I Press "([^"]*)"$/
 */
public function iPress($value)
{
    $val="$value";
    $page = $this->getSession()->getPage();
    $element = $page->find('css',"input[value=$val]");
    $element->doubleClick();
}

I am getting the below error message while executing.

And I Press "Achteraf betalen" Expected "]", but found.

So, please give some suggestions.. Thanks in advance..

Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42
Suraj
  • 297
  • 3
  • 18

1 Answers1

1

The problem is in your $page->find() call. Enclose the value in quotes:

$element = $page->find('css',"input[value='$val']");
JSchirrmacher
  • 3,243
  • 2
  • 19
  • 27
  • Thank you.. But while storing the parameter in the $val variable, we are keeping inside double quotes. Is this required here also?? – Suraj Jul 04 '16 at 12:10
  • The line `$val="$value";` only assigns $value to $val, the double quotes simple do nothing. You could as well omit the line and use $value directly. – JSchirrmacher Jul 04 '16 at 12:12
  • In contrast of that, in the $page->find() call the double quotes are necessary. They make it possible to use variables inside the string. This mechanism is called "interpolation". See https://en.wikipedia.org/wiki/String_interpolation – JSchirrmacher Jul 04 '16 at 12:14