Skip to content

Commit

Permalink
Merge pull request #114 from stof/execute_script
Browse files Browse the repository at this point in the history
Fixed the execution of self-executing functions not wrapped in braces
  • Loading branch information
stof committed Feb 5, 2014
2 parents b559226 + 776650c commit 256bb92
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Behat/Mink/Driver/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,11 @@ public function dragTo($sourceXpath, $destinationXpath)
*/
public function executeScript($script)
{
if (preg_match('/^function[\s\(]/', $script)) {
$script = preg_replace('/;$/', '', $script);
$script = '(' . $script . ')';
}

$this->wdSession->execute(array('script' => $script, 'args' => array()));
}

Expand Down

0 comments on commit 256bb92

Please sign in to comment.