Firefox14でJavaのWebdriverを使用しています。
私の問題は、WebdriverをCkEditorでうまく動作させることができないように見えることです。私は解決策を探しましたが、Firefox13または14のいずれかで動作させることができませんでした。これらは私が試した解決策です。
通常のsendKeysインタークション
textArea.sendKeys();
また
textArea.click(); textArea.sendKeys();
結果:このコードはCkEditorにテキストを生成しません
-
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!");
結果:このコードはサイトに移動してエディターをクリアしますが、CkEditorインスタンスにテキストを入力しません。
AdvancedUserInteractions-例:複数のバリエーションのActions()
textArea.click(); new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
と
new Actions(driver).sendKeys(textArea, "Hello, ckeditor!").build().perform();
と
new Actions(driver).click(textArea).sendKeys("Hello, ckeditor!").build().perform();
結果:これらはCkEditorにテキストを生成しません
iframeの切り替え(上記のIssue 3890による)とAdvancedUserInteractionsの使用
次のようなコード:
driver.switchTo().frame(iframe); textArea.click(); new Actions(driver).sendKeys("Hello, ckeditor!").build().perform();
結果:エラー「c.valueisundefined」をスローします
JavascriptとCkEditorApiの使用
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エントリに変換するために使用される/使用されない場合、「/」文字を除外します。このソリューションでは、大きな文字列に対して「 ERROR:null 」もスローされます。
私が試したことのないことについて何かアイデアはありますか?私が試したことの修正?他に何か提案はありますか?
ありがとう!