Node.js 如何在selenium nodejs中光标所在的位置发送键

Node.js 如何在selenium nodejs中光标所在的位置发送键,node.js,facebook,selenium,Node.js,Facebook,Selenium,我已经创建了一个在facebook帖子中发表评论的脚本,我确实点击了评论框,出现了光标do,但无法执行.sendKeys() 这是我的密码: var commentBox = driver.findElement(By.xpath('//*[@id="addComment_'+this.postIdSlice+'"]/div/div[2]/div/div/div/div[1]/div')); actions.mouseMove(commentBox).click().perform(); dri

我已经创建了一个在facebook帖子中发表评论的脚本,我确实点击了评论框,出现了光标do,但无法执行
.sendKeys()

这是我的密码:

var commentBox = driver.findElement(By.xpath('//*[@id="addComment_'+this.postIdSlice+'"]/div/div[2]/div/div/div/div[1]/div'));
actions.mouseMove(commentBox).click().perform();
driver.sleep(2000);
actions.sendKeys("Hello").perform();
但当我执行时,它不会向评论框发送“Hello”。
PS:postIdSlice是帖子的id,没有问题,只想在评论框中推送/发送字符串。

使用Xpath单击评论框,然后可以使用ActionSequence来排序输入并输入键

let action = new webdriver.ActionSequence(driver);
    action.sendKeys("comment");
    action.sendKeys(Keys.ENTER);

action.perform()

Facebook不允许你以任何自动方式与他们的网站互动。你必须使用API。非常感谢!!我犯了一个错误,使用了司机的动作。不是webdriver。