JavaScript webdriver-selenium`mouseMove`在Chromium上不正确? [英] JavaScript webdriver-selenium `mouseMove` inaccurate on Chromium?
问题描述
通过NodeJ(protractor
和selenium-webdriver
)在Windows 10上针对嵌入式Chromium运行Chromedriver.
Running Chromedriver through NodeJs - protractor
and selenium-webdriver
- against an embedded Chromium on Windows 10.
使用getLocation
似乎可以返回准确的位置,但是当我尝试让WebDriver将鼠标移动到那些位置时,鼠标不会到达那里-除非我将位置乘以约1.45.
It seems that using getLocation
returns accurate positions, but when I try to have WebDriver move the mouse to those positions, the mouse doesn't get there -- unless I multiply the positions by about 1.45.
那肯定是不对的?
这是我多年来第一次使用Selenium,但是我敢肯定我以前没有这样做.
This is the first time I've used Selenium in years, but I'm sure I haven't had to do this before.
下面是代码的缩写,其中包含一些webdriver日志: 1.将鼠标移到某个元素上, 1.按下鼠标键, 1.稍等一下要测试的系统做出反应, 1.稍微移动一下要测试的系统的鼠标, 1.等一下 1.移至目标元素 1.释放鼠标按钮.
Below is an abbreviation of the code, with some of the webdriver log: 1. move the mouse to an element, 1. depress the mouse button, 1. wait a little for the system under to test to react, 1. move the mouse a little for the system under test, 1. wait a little, 1. move to a target element 1. release the mouse button.
只要我什么都没改变,并且只能垂直移动,代码就可以工作.
The code works, provided I change nothing, and only move vertically.
如果我垂直移动,则看不到任何效果.
If I move vertically, I see no effect.
如果我在一个Chromium窗口中两次运行代码,并在每次运行开始时加载测试文档,则第二次运行会在文档加载过程中挂起.
If I run code twice in one Chromium window, loading the test document at the start of each run, the second run hangs around document loading.
var destLocation,
fromEl = $('elementA'),
destEl = $('elementB');
destEl.getLocation()
.then(() => {
browser.driver.actions()
.mouseMove( fromEl, {x: 10, y: 10} )
// 09:56:37.222 INFO - Done: [mousemove: 5 true]
.mouseDown( fromEl, {x: 10, y: 10} )
// 09:56:37.230 INFO - Done: [mousedown: no args]
.perform();
})
.then(() => {
browser.sleep(400);
})
.then(() => {
// Business logic requires this
browser.driver.actions().mouseMove( fromEl, {x:15, y:15} )
// 09:56:37.719 INFO - Done: [mousemove: 5 true]
.mouseDown()
// 09:56:37.726 INFO - Done: [mousedown: no args]
.perform();
})
.then(() => {
browser.sleep(400);
})
.then(() => {
browser.driver.actions().mouseMove( $('body'), destLocation ).perform();
// 09:56:38.209 INFO - Done: [mousemove: 9 true]
})
.then(() => {
browser.sleep(200);
})
.then(() => {
browser.driver.actions().mouseUp().perform();
// 09:56:38.425 INFO - Done: [mouseup: nothing]
});
- Selenium v2.52.0和Core v2.52.0.从版本4c2593c构建
- 驱动程序信息:driver.version:RemoteWebDriver
- 操作系统:Windows 10 10.0 amd64
- Java:Oracle Corporation 25.91-b14
- chromedriver_2.21和chromedriver_2.15.322448似乎具有相同的作用
- CEF 3.2454.1344.g2782fb8
- 铬45.0.2454.101
- WebKit 537.36
- JavaScript 4.5.103.35
- Selenium v2.52.0, with Core v2.52.0. Built from revision 4c2593c
- Driver info: driver.version: RemoteWebDriver
- OS: Windows 10 10.0 amd64
- Java: Oracle Corporation 25.91-b14
- chromedriver_2.21 and chromedriver_2.15.322448 seem to act the same way
- CEF 3.2454.1344.g2782fb8
- Chromium 45.0.2454.101
- WebKit 537.36
- JavaScript 4.5.103.35
推荐答案
已将此错误报告给Chromium团队,该错误无法用所有库的最新版本重现该问题.
This was reported to the Chromium team as a bug, who could not reproduce the issue with the latest versions of all libraries.
这篇关于JavaScript webdriver-selenium`mouseMove`在Chromium上不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!