0

I'm new in selenium webdriver & I want to type in iframe with Rich text editor like this :

<iframe frameborder="0" aria-describedby="cke_24" title="Rich text editor, Post_description" src="" tabindex="-1" allowtransparency="true">
#document
<html dir="rtl" lang="ar" class="CSS1Compat" contenteditable="true">
<head></head>
<body spellcheck="false" class="cke_show_borders">
<p>
</p>
</body>
</html>
</iframe>

I used this :

WebDriver driver;

WebElement frame = driver.findElement(By.xpath("//iframe[@title = 'Rich text editor, Post_description']"));
driver.switchTo().frame(frame);
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys(desc);
driver.switchTo().defaultContent();

But it does nothing... It only types white lines... Any help?

1

1 Answer 1

1
WebElement frame = driver.findElement(By.xpath("//iframe[@title = 'Rich text editor, Post_description']"));
driver.switchTo().frame(frame);
WebElement body = driver.findElement(By.tagName("body"));
body.sendKeys("Hello world");
driver.switchTo().defaultContent();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.