Created
August 12, 2015 15:05
-
-
Save jonathanfranks/fbe26a75704cfa5846f8 to your computer and use it in GitHub Desktop.
Behat CKEditor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Then /^I fill in wysiwyg field "([^"]*)" with "([^"]*)"$/ | |
*/ | |
public function iFillInWysiwygOnFieldWith($locator, $value) { | |
$el = $this->getSession()->getPage()->findField($locator); | |
$fieldId = $el->getAttribute('id'); | |
if (empty($fieldId)) { | |
throw new Exception('Could not find an id for field with locator: ' . $locator); | |
} | |
$this->getSession()->executeScript("CKEDITOR.instances[\"$fieldId\"].setData(\"$value\");"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe you have to use the
addslashes()
with$value
.