Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created January 11, 2014 01:02
Show Gist options
  • Save alnutile/8365610 to your computer and use it in GitHub Desktop.
Save alnutile/8365610 to your computer and use it in GitHub Desktop.
Allow user to submit a form with no submit button
/**
* Some forms do not have a Submit button just pass the ID
*
* @Given /^I submit the form with id "([^"]*)"$/
*/
public function iSubmitTheFormWithId($arg)
{
$node = $this->getMainContext()->getSession()->getPage()->find('css', $arg);
if($node) {
$this->getMainContext()->getSession()->executeScript("jQuery('$arg').submit();");
} else {
throw new Exception('Element not found');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment