Sto usando WebDriver in Java con Firefox 14.utilizzando Selenio WebDriver con CKEditor in Firefox 14
Il mio problema è che non riesco a ottenere WebDriver a giocare bene con CKEditor. Ho cercato soluzioni, ma sono stato in grado di ottenere qualsiasi lavoro sia in Firefox 13 o 14. Queste sono le soluzioni che ho provato:
I normali Sendkeys interction
textArea.sendKeys();
o
textArea.click(); textArea.sendKeys();
Risultato: Questo codice non produrrebbe alcun testo nella CKEditor
Il codice da Selenium issue 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!");
Risultato: Questo codice andrà al sito e chiaro l'editor, ma non metterà in alcun testo nell'istanza CKEditor.
AdvancedUserInteractions - ad es. Azioni() in più varianti
textArea.click(); new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
e
new Actions(driver).sendKeys(textArea, "Hello, ckeditor!").build().perform();
e
new Actions(driver).click(textArea).sendKeys("Hello, ckeditor!").build().perform();
risultati: Questi non produrranno alcun testo nella CKEditor
commutazione iframe (come da Issue 3890 sopra) e usando Advan cedUserInteractions
codice simile a:
driver.switchTo().frame(iframe); textArea.click(); new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
Risultato: Genera errore "c.value è indefinito"
Usando il Javascript e l'API CKEditor
JavascriptExecutor js = (JavascriptExecutor) d; System.out.println("[debug] Set Text: " + setText); js.executeScript("CKEDITOR.instances.editor1.setData('<p> "+ setText +"</p>');");
Risultato: esclude il carattere '/' quando "org.apache.commons.lang.StringEscapeUtils.escapeHtml" è/non viene utilizzato per convertire "setText" in voci HTML. Questa soluzione genera anche "ERRORE : null" su stringhe di grandi dimensioni.
Qualche idea su cose che non ho provato? Correzioni per cose che ho provato? Qualche altro suggerimento?
Grazie!