[英]How can I click 2 buttons simultaneously?
I work in a Call center (ticket based Support) and for me to get a ticket I need to click on 2 Buttons.我在呼叫中心工作(基于票的支持),为了获得票,我需要单击 2 个按钮。 the one that opens the tickets section, and the one that actually gets me a ticket.
打开门票部分的那个,以及实际上给我一张票的那个。 After i click on the Get_ticket class, the ticket box closes.
单击 Get_ticket 类后,票框关闭。 So i need to start again to click on the "Tickets" Button, and then on Get_Ticket.
所以我需要重新开始点击“Tickets”按钮,然后点击Get_Ticket。 Tickets button -> Get_ticket.
门票按钮 -> Get_ticket。 And repeat and repeat.
并重复和重复。 I want to tell Google console to help me with this.
我想告诉 Google 控制台帮我解决这个问题。 I found a way but it's not very friendly.
我找到了一种方法,但它不是很友好。 I tried with the button.click function at a different interval but it's not working...If i put the function separately, it's working, but when I put the functions at the same time in Console, it's not working.
我尝试以不同的时间间隔使用 button.click 功能,但它不起作用......如果我单独放置该功能,它会起作用,但是当我将这些功能同时放入控制台时,它不起作用。 Can you please give me an advice ?
你能给我一个建议吗? Those are the functions:
这些是功能:
1.(click on TICKETS) 1.(点击门票)
var button = document.getElementsByClassName("_1f8o8ru7")[0];
setInterval(function(){button.click();},2000);
2.(Click on GET TICKET) 2.(点击获取门票)
var button2 = document.getElementsByClassName("_sl2x43m")[0];
setInterval(function(){button2.click();},2500);
您需要调用第一个按钮单击第一个按钮在给定超时时调用另一个方法,因此第一次单击第一个按钮后单击第一个按钮调用具有 500 次超时的另一个按钮方法就可以了,无需执行 2000 或 2500 次超时
The second interval should be added inside the first interval.第二个区间应添加在第一个区间内。 I also recommend to use
setTimeout
, instead of setInterval
.我还建议使用
setTimeout
,而不是setInterval
。
setInterval(function(){
var button = document.getElementsByClassName("_1f8o8ru7")[0];
button.click();
setInterval(
function(){
var button2 = document.getElementsByClassName("_sl2x43m")[0];
button2.click();
},2500);
},2000);
After you figure it out, you can save your code in a js file: my_script.js
and use Chrome extension JS Injector to automatically inject it in your page, without needing to use Chrome DEV Tools.搞清楚之后,你可以将你的代码保存在一个js文件中:
my_script.js
并使用Chrome扩展JS Injector自动将其注入到你的页面中,而无需使用Chrome DEV工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.