There is a bit problem using selenium to type in textarea formatted by tinymce. We can’t use
page.FindElement(By.XPath("//textarea[@name='textareaName']")).SendKeys(content);
because tinymce uses html inside iframe instead of textarea to perform wysiwyg editing.
To make selenium type in tinymce iframe, write this in test code (this example using c#.net)
driver.SwitchTo().Frame(iframeLocator); driver.FindElement(By.XPath("//body[@id='tinymce']")).<br>SendKeys(sValue); driver.SwitchTo().DefaultContent();
where
driver = IWebDriver iframeLocator = name of iFrame sValue = desired content of textarea
Tinymce set the name of iframe as textareaid_ifr.
If textarea ID is content, iframe name would be content_ifr
Leave a Reply