[英]How fast are Selenium Webdriver “Actions” performed?
I've been playing around with Selenium (chromedriver, Java). 我一直在玩Selenium(chromedriver,Java)。 I got interested in seeing what it would take to make Selenium move the mouse around in a human-like way;
我有兴趣看到让Selenium以类似人的方式移动鼠标需要做些什么。 this led me to the Selenium Actions class.
这导致我进入了Selenium Actions类。
How fast are Selenium Actions performed? Selenium Actions的执行速度有多快? I figure this is important to know if I want to move the mouse with a specific velocity.
我认为,如果我想以特定的速度移动鼠标,这一点很重要。 I tried executing the following code:
我尝试执行以下代码:
Actions builder = new Actions(driver);
Action action = builder.moveByOffset(4,0).build();
LocalTime before = LocalTime.now();
for (int i = 0; i < 100; i++) {
action.perform();
}
LocalTime after = LocalTime.now();
System.out.println(Duration.between(before, after).toMillis());
If I run the above code with the chrome "developer tools" panel open it runs in ~300ms. 如果我使用chrome“开发者工具”面板打开上面的代码,它会在~300ms内运行。 With the "developer tools" closed it runs in ~1700ms.
随着“开发者工具”关闭,它运行在~1700ms。
ChromeDriver does not support the W3C WebDriver protocol. ChromeDriver不支持W3C WebDriver协议。 The JSON-wire protocol does not allow for setting the duration of a mousemove (and is therefore left as an implementation detail for the remote-end).
JSON-wire协议不允许设置mousemove的持续时间(因此留作远程端的实现细节)。
I'll be switching the GeckoDriver as it supports W3C WebDriver protocol. 我将切换GeckoDriver,因为它支持W3C WebDriver协议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.