Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如您所知,Selenium IDE 可以向您显示一个脚本并告诉您您刚刚操作了什么元素。
我不知道这背后发生了什么。每个自动化框架都可以知道您点击、输入或选择了什么元素。
我想要一个控制台输出并显示我刚刚在浏览器中操作的每个元素。
我该如何实施?
使用 jQuery:
$("*").click(function(e) { console.log(this); }.blur(function(e) { console.log(this); };
只需在页面上的某个地方弹出它,它就会记录在单击或选择时被操纵的元素。我敢肯定还有其他操纵方式,但以上只是一个开始。添加更多处理程序将是微不足道的 -.change()并且.hover()浮现在脑海中。
.change()
.hover()