How to type in Rich Text Editor that is located in iFrame ?
public void typeInRichTextEditor() {
String baseURL = "http://www.speurders.nl/plaatsen";
WebDriver driver = new FirefoxDriver();
driver.get(baseURL);
((JavascriptExecutor) driver).executeScript("window.scrollTo(0,"
+ driver.findElement(
By.xpath("//iframe[@id='description_ifr']")).getLocation().y + ")");
WebElement descriptionElement = driver.findElement(By
.xpath("//iframe[@id='description_ifr']"));
driver.switchTo().frame(descriptionElement);
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys("Anand Somani");
driver.switchTo().defaultContent();
driver.quit();
}
public void typeInRichTextEditor() {
String baseURL = "http://www.speurders.nl/plaatsen";
WebDriver driver = new FirefoxDriver();
driver.get(baseURL);
((JavascriptExecutor) driver).executeScript("window.scrollTo(0,"
+ driver.findElement(
By.xpath("//iframe[@id='description_ifr']")).getLocation().y + ")");
WebElement descriptionElement = driver.findElement(By
.xpath("//iframe[@id='description_ifr']"));
driver.switchTo().frame(descriptionElement);
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys("Anand Somani");
driver.switchTo().defaultContent();
driver.quit();
}