javascript - 在 Intern.js Leadfoot 中,如何执行 CTRL 单击

标签 javascript intern leadfoot

我只是想知道在 Leadfoot 中执行 Ctrl + 单击操作的首选方法是什么。在 java 中,我会使用 Actions 类并使用 keyDown,但由于我们已经转向基于 JS 的框架,我彻底脱离了水!

我在api中看到有一个pressKeys函数,但它似乎没有做我们需要的事情。我曾考虑过使用 jQuery 来做到这一点,但我真的宁愿将其保留在当前框架中。

非常感谢任何帮助。

彼得

最佳答案

您可以使用pressKeys,例如:

command.moveMouseTo(myBtn)
       .pressKeys(keys.CONTROL)
       .clickMouseButton()
       .pressKeys(keys.CONTROL)

关于pressKeys值得记住的一件好事( https://theintern.github.io/leadfoot/Command.html#pressKeys )

keys: The text to type in the remote environment. It is possible to type keys that do not have normal character representations (modifier keys, function keys, etc.) as well as keys that have two different representations on a typical US-ASCII keyboard (numpad keys); use the values from leadfoot/keys to type these special characters. Any modifier keys that are activated by this call will persist until they are deactivated. To deactivate a modifier key, type the same modifier key a second time, or send \uE000 ('NULL') to deactivate all currently active modifier keys.

关于javascript - 在 Intern.js Leadfoot 中,如何执行 CTRL 单击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35361468/

相关文章:

javascript - 读取 D3 中没有标题行的 csv/tsv

javascript - 如果包含在数组中,则从字符串中删除单词?

javascript - 将 Javascript 数组发布到 WebAPI

javascript - 实习生 : Checking for Elements that Shouldn't Exist

javascript - 具有全局行为主题的动态选项卡?

selenium - 使用 Intern/Leadfoot 进行功能测试条件

javascript - 通过独立浏览器客户端运行 The Intern 会丢失套件中的 this.remote

javascript - 如何在 intern JS 中捕获异常?

selenium - 为什么在开始我的实习测试时,浏览器中会运行一堆铅足的东西?