Using Selenium Webdriver with CkEditor in Firefox 14

I am using Webdriver in Java with Firefox 14.

My problem is that I cannot get webdriver to play well with CkEditor. I was looking for solutions, but could not work in Firefox 13 or 14. These are the solutions I tried:

  • Normal sendKeys connection

    textArea.sendKeys();
    

    or

    textArea.click();
    textArea.sendKeys();
    

    Result : this code will not print any text in CkEditor

  • Selenium issue code 3890

    d.get("http://ckeditor.com/demo");
    WebElement iframe = d.findElement(By.tagName("iframe"));
    d.switchTo().frame(iframe);
    WebElement tinymce = d.findElement(By.tagName("body"));
    tinymce.clear();
    tinymce.sendKeys("Hello, ckeditor!");
    

    Result: This code will go to the site and clear the editor, but will not put any text into the CkEditor instance.

  • AdvancedUserInteractions - for example. Actions () in several ways

    textArea.click();
    new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
    

    and

    new Actions(driver).sendKeys(textArea, "Hello, ckeditor!").build().perform();
    

    and

    new Actions(driver).click(textArea).sendKeys("Hello, ckeditor!").build().perform();
    

    Result . This will not lead to the creation of any text in CkEditor

  • ( 3890 ) AdvancedUserInteractions

    :

    driver.switchTo().frame(iframe);
    textArea.click();
    new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
    

    : "c.value is undefined"

  • Javascript CkEditor Api

    JavascriptExecutor js = (JavascriptExecutor) d;
    System.out.println("[debug] Set Text: " + setText);
    js.executeScript("CKEDITOR.instances.editor1.setData('<p> "+ setText +"</p>');");
    

    : '/', "org.apache.commons.lang.StringEscapeUtils.escapeHtml" "setText" Html. ": null" .

, ? , ? ?

!

+5
3

iframe, JS .

final WebDriver frame = driver.switchTo().frame(findElement(By.id("locator")); //any locator
    ((JavascriptExecutor) driver).executeScript("document.body.innerHTML='" + TestValueThatYouWantToType + "'");
    driver.switchTo().defaultContent();
+3

wait tinymce.clear();, .

0

those who encounter this problem can link to this URL:

http://bharath-marrivada.blogspot.com/2012/03/fckeditor-switch-activeelement.html

I have fixed a problem with this: D

0
source

All Articles