在 Leadfoot Command#moveMouseTo 的文档中,它声明每个参数都是可选的(https://theintern.github.io/leadfoot/Command.html#moveMouseTo)。当我传入一个元素而不传入 X 或 Y 偏移量时,我收到一个关于要求存在偏移量的命令的错误。
message: [POST http://localhost:4444/wd/hub/session/62d8467c-21d9-4565-bc9d-e527c91dc61d/moveto / {}] Missing parameters: element, xoffset, yoffset (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
这是有问题的代码:
.then(function () {
return contextMenu.Options.Actions.element;
})
.then(function (element) {
return Remote.moveMouseTo(element);
})
contextMenu.Options.Actions.element 定义为:
return Remote
.setFindTimeout(5000)
.findByXpath('/html/body/table[1]/tbody/tr[2]');
根据文档,这应该将鼠标移动到传递元素的中心。显然,这不会发生。我做错了什么吗?这是否没有正确记录,或者这是 Leadfoot 中的错误?
编辑测试代码的正确格式是:
.then(contextMenu.Options.Actions.element)
.then(function (element) {
return Remote.moveMouseTo(element);
})