Gwt 从Selenium测试中的RichTextArea获取值
我正在尝试使用Selenium测试是否在GWT的RichTextArea中从服务器加载了值 我在做什么Gwt 从Selenium测试中的RichTextArea获取值,gwt,selenium,webdriver,selenium-webdriver,selenium-chromedriver,Gwt,Selenium,Webdriver,Selenium Webdriver,Selenium Chromedriver,我正在尝试使用Selenium测试是否在GWT的RichTextArea中从服务器加载了值 我在做什么 @FindByDebugId("gwt-debug-about-me") private WebElement aboutMeRichText; 当我发送密钥时,没有问题,文本打印在RichTextArea中 但当我尝试此操作时(检索值): 它返回一个空字符串 当我查看HTML中生成的内容时,它是这样的: <iframe class="GJUJXOPBLP-com-asdf-asdf-
@FindByDebugId("gwt-debug-about-me")
private WebElement aboutMeRichText;
当我发送密钥时,没有问题,文本打印在RichTextArea中
但当我尝试此操作时(检索值):
它返回一个空字符串
当我查看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>
#文件
你好!
如何检索“Hi there!”文本?这是一个
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();
我在GXT中遇到了类似的问题,我试图检索的字段有一个名为“只读”的属性,当设置该属性时,我无法检索文本,有点与该属性相矛盾,但是。。。你有这样的经历吗?@Oliver:你对此有什么反馈吗?对你有用吗?
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();