|
最近需要使用selenium来设计自动化测试用例,其中需要在富文本编辑器中输入内容,直接使用type没有效果,有人说可能是由于bdeTextArea这个div元素没有focus的关系,
页面结构为:
<div contenteditable="true" style="overflow: auto;" ondblclick="return BdeText.clickHandler(event)" onclick="return BdeText.clickHandler(event)" onkeyup="return BdeText.keyUpHandler(event)" onkeydown="return BdeText.keydownHandler(event)" onmouseup="return BdeText.selectionChangeHandler(event)" onpaste="return BdeText.pasteHandler(event)" onfocus="return BdeText.focusHandler(event)" onselectionchange="return BdeText.selectionChangeHandler(event)" id="bdeTextArea"><br></div>
使用的selenium:
selenium.click("title");
selenium.type("title", "h2010812");
selenium.click("xpath=//div[@id='bdeTextArea']");
selenium.type("xpath=//div[@id='bdeTextArea']", "ZQq2010812"); |
|