我无法使用webdriver自动执行键盘操作。我在下面尝试过:
1
String selectAll = Keys.chord(Keys.CONTROL, "a");
driver.findElement(By.cssSelector(".notebook-rte-prompt.active .rte-editbox")).sendKeys(selectAll);
2
driver.findElement(By.cssSelector(".notebook-rte-prompt.active .rte-editbox")).click();
Actions action = new Actions(driver);
action.keyDown(Keys.CONTROL).sendKeys(String.valueOf('\u0061')).perform();
3
driver.findElement(By.cssSelector(".notebook-rte-prompt.active .rte-editbox")).click();
Robot r = new Robot();
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_A);
富文本编辑器代码如下。
<div class="rte-editbox" contenteditable="true" spellcheck="false" autocapitalize="off"
autocomplete="off" autocorrect="off" style="height: 62px;">Editor </div>
答案 0 :(得分:0)
也许您可以先尝试点击编辑框,例如:
{
"Deposits": 1,
"clicks": 12688190,
"Signups": 45,
"m": 2,
"y": 2016 }