我正在使用 Protractor 进行 e2e 测试,并且我正在使用多个测试规范。 从一个测试规范到另一个测试规范,我注意到我的鼠标留在了上一个规范的最后一个位置。
我希望鼠标从每个规范的默认位置开始。 我相信应该是左上角。
目标是我知道每次测试开始时我的鼠标从哪里开始,并且我可以相应地调整我的测试,并且每次测试都将从鼠标在相同的基线处开始。
例如:
//Assume this is the first spec
browser.actions().mouseMove(x: 15, y: 25).perform().then(function() {
//code
});
//If this is in another spec, this mouseMove will start from the x: 15 & y: 25 location
browser.actions().mouseMove(x: 153, y: 125).perform().then(function() {
//code
});
最佳答案
每次测试之前或之后手动将鼠标移动到“0, 0”:
browser.actions().mouseMove({x: 0, y: 0}).perform();
关于javascript - Protractor 测试 - 如何将鼠标位置重置为默认原点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620956/