简体   繁体   English

镀铬延伸力鼠标移动

[英]chrome extension force mouse move

I am writing a chrome extension that records your actions like ( mouse click, keyboard keyup ). 我正在编写一个chrome扩展,记录您的操作(鼠标单击,键盘键)。 The idea of the extension is to help me and my colleagues to reduce the boring testing of our web based project. 扩展的想法是帮助我和我的同事减少我们基于Web的项目的无聊测试。 I made it to record the events and store it on the dev server as mysql so i can use or share to them. 我做了它来记录事件并将其作为mysql存储在开发服务器上,以便我可以使用或共享它们。 But the problem is replaying the saved actions. 但问题是重播已保存的操作。

So how if there is a way to force mouse move, mouse click events. 那么如果有办法强制鼠标移动,鼠标点击事件。 Can it be done from flash,java or something like that. 它可以通过flash,java或类似的东西来完成。

PS. PS。 The project is Extjs but i want to make the extension useful for developer using other frameworks and publish it. 该项目是Extjs,但我想使扩展对使用其他框架的开发人员有用并发布它。

Imagine some random website controlling your mouse ... not cool, is it? 想象一下随机网站控制你的鼠标......不酷,是吗? (That's why you cant force mousemove via javascript) (这就是为什么你不能通过JavaScript强制mousemove)

However, you can trigger clicks on elements. 但是,您可以触发元素的点击。 To achieve that, you need to save the event(mouse-over|out/(dbl)click/whatever) and the according element (in the eventfunction: this). 要实现这一点,您需要保存事件(mouse-over | out /(dbl)click / whatever)和相应元素(在eventfunction:this中)。 That should be sufficient to simulate theworkflow. 这应该足以模拟工作流程。

jQuery-Example: jQuery的实施例:

$('#item').click();
$('#item').trigger('click');

vanilla javascript: 香草javascript:

document.querySelector("#item").click();

Consider using Selenium for this. 考虑使用Selenium It has support for many languages, and you can script your whole test with it. 它支持多种语言,您可以使用它编写整个测试的脚本。 You can for example set it to click on an element, wait for something to happen or fill text boxes. 例如,您可以将其设置为单击元素,等待某些事情发生或填充文本框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM