繁体   English   中英

将密钥发送到Selenium中的Rich Text编辑器控件

[英]send keys to Rich text editor control in selenium

我正在尝试使用selenium在文本编辑器中编写代码,但是当我运行测试时未找到富文本框时,这是HTML代码:

<document>
<html lang="en" dir="ltr">
<head>
<body class="cke_editable cke_editable_themed cke_contents_ltr" contenteditable="true" spellcheck="false" title="This is a rich text editor control.">
<p>
<br/>
</p>
</body>
</html>
</document>

这就是我到目前为止从Eclipse上的Java代码获得的东西

  WebElement frame = driver.findElement(By.xpath(".//*[@title='This is a rich text editor control.']/p/br"));
            driver.switchTo().frame(frame);
            WebElement body = driver.findElement(By.tagName("body"));
            body.sendKeys("Hello world");
            driver.switchTo().defaultContent();

这里有什么想法吗? 不是iFrame,所以我什至不确定是否需要switchto命令

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM