【问题标题】:How to see mouse current position in nightwatch.js?如何在 nightwatch.js 中查看鼠标当前位置?
【发布时间】:2016-04-10 09:51:51
【问题描述】:

我是 nightwatch.js 的新手,我想检查鼠标的当前位置,有什么方法可以查看鼠标的当前位置吗?目前我正在使用

client.getLocation("#myId", function (result) {
  console.log(result.x);
  console.log(result.x);
});

但如果我使用以下代码,上面的代码给出了#myId 元素的位置。

client.moveToElement("#myId", 250, 70, function (result) {
  console.log(result.status);
});

执行上述函数后,我的光标将从 #myid 元素从 250 像素移动到 x 轴和 70 像素到 y 轴。

但我如何检测鼠标的先前位置

【问题讨论】:

    标签: javascript ui-automation browser-automation nightwatch.js


    【解决方案1】:

    只需记住您将其移动到的元素的位置即可。在 Python 和 Chrome 中,鼠标从窗口中间开始,在调整大小之后也是如此。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多