I\'m facing the following problem.I can not type text in iframe in which there is a text editor:Here is the html:
There are multiple ways of doing it. Here's an article you might want to have a look.
Test WYSIWYG editors using Selenium WebDriver
This approach is the one you have tried and didn't work. Please try make sure your locators to and
are correct. Otherwise I'd suggest using
JavaScriptExecutor
for more stable solutions.
WaitTool.waitForElementPresent(Browser.instance, By.className("cke_wysiwyg_frame"), 10);
WebElement iframe = Browser.instance.findElement(By.className("cke_wysiwyg_frame"));
Browser.instance.switchTo().frame(iframe);
WebElement description = Browser.instance.findElement(By.cssSelector("body"));
(JavascriptExecutor)Browser.instance.executeScript("arguments[0].innerHTML = 'Set text using innerHTML
'", description);
// no need to switch iframe
(JavascriptExecutor)Browser.instance.executeScript("CKEDITOR.instances.ckeditor.setData('Native API text
Editor')");