0

GWT の RichTextArea にサーバーから値がロードされているかどうかを Selenium でテストしようとしています。

私がやっている

@FindByDebugId("gwt-debug-about-me")
private WebElement aboutMeRichText;

キーを送信すると、問題はありません。テキストは RichTextArea に出力されます。

しかし、これを試すと(値を取得します):

aboutMeRichText.getText() 

空の文字列を返します。

HTMLで生成されたものを見ると、次のようなものです:

<iframe class="GJUJXOPBLP-com-asdf-asdf-client-resource-Resources-Styles-textBox hasRichTextToolbar" id="gwt-debug-about-me">
#document
<html><head></head><body>Hi there !</body></html>
</iframe>

「こんにちは!」を取得するにはどうすればよいですか?文章?

4

1 に答える 1

1

これiframeは であり、通常の とは異なるWebElementため、最初に切り替える必要があります。

driver.switchTo().frame(aboutMeRichText);
WebElement body = driver.findElement(By.TagName("body")); // then you find the body
body.getText();

// get out of the editor
driver.switchTo().defaultContent();
于 2013-08-04T22:15:31.203 に答える