String text = "a new post";
String js = "document.getElementById('Editor_Edit_EditorBody_ifr').contentDocument.write('" + text + "');";//Editor_Edit_EditorBody_ifr为所在iframe的id
((JavascriptExecutor) dr).executeScript(js);
经验证可行
方法三:需要跳入iframe,但提交需要跳出iframe
String text = "a new post a new post a new post a new post a new post ";
dr.switchTo().frame(dr.findElement(By.id("ueditor_0")));//跳转iframe ueditor_0为该iframe的id
dr.findElement(By.tagName("body")).sendKeys(text);//选中该iframe的body属性
Thread.sleep(5000);
dr.switchTo().defaultContent();//跳出iframe
dr.switchTo().frame("mainFrame");
dr.switchTo().frame("rightFrame");
dr.findElement(By.xpath(".//*[@id='complete_btn']/span")).click();//提交
经验证可行