Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gwt 从Selenium测试中的RichTextArea获取值_Gwt_Selenium_Webdriver_Selenium Webdriver_Selenium Chromedriver - Fatal编程技术网

Gwt 从Selenium测试中的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-

我正在尝试使用Selenium测试是否在GWT的RichTextArea中从服务器加载了值

我在做什么

@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();