driver.switchTo().frame("tinymce_iframe");
String script="var editor=tinyMCE.get('tinymce_textarea');";
JavascriptExecutor js=(JavascriptExecutor) driver;
js.executeScript(script);
I'm encountering a WebDriverException while trying to run this javascript code, as it returns an error stating that tinyMCE is not defined.
<html>
<script type="text/javascript" src="tinymce3.5.1/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
theme : "advanced",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
mode : "exact",
elements : "tinymce_textarea"
});
</script>
<body>
<textarea cols="80" rows="10" id="tinymce_textarea" name="tinymce_textarea">
<h1><span id="1">Article</span> <span id="2">Title</span></h1>
<p><span id="3">Here's</span> <span id="4">some</span> <span id="5">sample</span> <span id="6">text</span> <span id="7">Hello</span> <span id="8" >World.</span> </p>
</textarea>
</body>
</html>